Fog Creek Software
Discussion Board

Using database fields in a preprinted form

I currently have a database program developed in Delphi whereby I would like to add the ability to print form field values to a preprinted form containing one or more pages. As such, I would appreciate any suggestions as well as feedback regarding issues to be considered such as getting the printed format (containing the database field values) to conform to the layout of the preprinted form, addressing the type of printer being used, etc. Thank you ahead of time.

Marty Potokar
Monday, December 2, 2002

This might be more useful:

Prakash S
Monday, December 2, 2002

They have a fairly comprehensive solution for forms.

Tim Sullivan
Monday, December 2, 2002


I only know of two ways to print to pre-printed forms:

Solution 1

1.  Grab your favorite report tool.  (Crystal Reports or ReportBuilder Pro would be my suggestions).

2.  Place the fields you require on the report. 

3.  Adjust the fields to where you think they might line up on the pre-printed form.  (Hint:  A $0.99 ruler goes a long way in this exercise)

4.  Print.

5.  Grab the printed page.  Grab the pre-printed form.  Place the pre-printed form below the newly printed report.  Hold up to the light.

6.  If all the fields line up, you are done.  Otherwise repeat steps 3-6.

Solution 2

1.  Buy 3rd party software to do the job.

A few notes:

1.  Solution 2 is your best bet for government forms.  Nearly all of them are available in digital form of some sort.

2.  Solution 1 is your only choice for doing custom forms (as for as I know).  i.e. Your client is some small business/office that has a need for this type of report.


beach bum
Monday, December 2, 2002

I have done this in Access before by:

- scanning in form and saving the image as a bitmap
- making the bitmap the background of an Access report
- positioning the fields textboxes on top of the bitmap

All my client wanted to do was fax the form off, so in this case it worked great.

Matthew Lock
Monday, December 2, 2002

Thanks to Tim Sullivan for the WPTools URL (one I was unaware of and well be sure to check out) as well as Matthew Lock for his suggestion (already thought of this but may be somewhat difficult given the type of preprinted forms I have  to work with). While I am familiar with the JoelOnSoftWare Delphi discussiuon, I had since submitted this question to one of the Delphi newsgroups that I frequent. However, I thought it might be beneficial to sollicit a response on this subject matter from other than Delphi programmers, hence the post on this forum. As for the Beach Bum's response, NO Comment!

Marty Potokar
Tuesday, December 3, 2002

I've done this in Delphi in 2 ways:

1. Convert the preformatted form to WMF Format (it's much smaller than a bitmap image if you use the WMF codes to draw lines, text etc.) Place the WMF as a background for a form, drop the database fields exactly where they need to be input (reset the border property so the border isn't visible). Then we wrote a function to convert a regular TForm to a QuickReport based report at runtime with the same WMF background, and then printed or previewed the report. Worked well for what we needed.

2. Built an application that allows you to "draw" forms, complete with an IDE for positioning controls, writing text etc. Then we wrote a custom printing utility that would print the form to printer or the screen canvas (for preview).

Doing 2. was far more work but gave us very precise form printing capabilities. 1. is much easier to write, but we did have issues with some forms and printers (that didn't like the WMFs) which we had to hand-code separately.

Deepak Shenoy
Tuesday, December 3, 2002

*  Recent Topics

*  Fog Creek Home