Board index » delphi » Printing on Pre-Printed Forms

Printing on Pre-Printed Forms

I have a need for printing on pre-printed forms. I wrote some code with
Delphi 2.1 using the Printer.Canvas.TextOut procedure to position the text
precisely on the form. It works great with an HP LaserJet 5 printer.
However, when using another printer (a  HP LaserJet II for example), the
text does not line up on the form.  It starts off okay, but 'drifts' towards
the end of the page.

Does anyone know of any special tricks to ensure alignment regardless of
printer?

Thanks!

Jay Eisenstock
ca...@ix.netcom.com

 

Re:Printing on Pre-Printed Forms


Quote

>Does anyone know of any special tricks to ensure alignment regardless of
>printer?

>Thanks!

>Jay Eisenstock

If you find a way to do this, I too would be very interested.  I think you are asking for the
impossible...

Mark
--------------------------
m...@sepcoinc.com

Re:Printing on Pre-Printed Forms


Jay,

I can't tell you the exact code, but you have to retrieve most of the
properties for the printer via API. You need to get the ppi and all that
stuff.
I wouldn't do.
Try to arrange with QR or something like that and let it be done by
these components.

Luc.

Jay Eisenstock schrieb:

Quote

> I have a need for printing on pre-printed forms. I wrote some code with
> Delphi 2.1 using the Printer.Canvas.TextOut procedure to position the text
> precisely on the form. It works great with an HP LaserJet 5 printer.
> However, when using another printer (a  HP LaserJet II for example), the
> text does not line up on the form.  It starts off okay, but 'drifts' towards
> the end of the page.

> Does anyone know of any special tricks to ensure alignment regardless of
> printer?

> Thanks!

> Jay Eisenstock
> ca...@ix.netcom.com

Re:Printing on Pre-Printed Forms


How about working with % of Page Width / Page Height instead of pixel/dpi
resolution??

Dave Higgs
Premier Software
South Africa

Re:Printing on Pre-Printed Forms


Quote
Jay Eisenstock wrote:

> I have a need for printing on pre-printed forms. I wrote some code with
> Delphi 2.1 using the Printer.Canvas.TextOut procedure to position the text
> precisely on the form. It works great with an HP LaserJet 5 printer.
> However, when using another printer (a  HP LaserJet II for example), the
> text does not line up on the form.  It starts off okay, but 'drifts' towards
> the end of the page.

> Does anyone know of any special tricks to ensure alignment regardless of
> printer?

> Thanks!

> Jay Eisenstock
> ca...@ix.netcom.com

Are you using routines such as SetMapMode on the printers canvas?  This
way you can specify to use Mills, inches or printer points to print.
Using the TPrinter.Canvas.TextOut(x,y,'') without it goes to device
units, ie 'pixlels' on the printer, which vary with page size,
resolution, printer etc.  There is alot you can do to make sure it
always aligns no matter what the printer, and it usually involves the
Windows API.  However, do not do what I did and try to figure out how to
print using the Win32 API help, it was an unmitigated disater......
There are several tutorials scattered around the web, and most books on
Delphi have a printing section.

You nearly always have to go go past the delphi printer to the API for
consistent printing results.
You also might try downloading a printer/preview component with source
code, and learning from that.

Cheers,
Matt.

Re:Printing on Pre-Printed Forms


My solution to this problem is much more rudimentary.  When the user first
installs my program or switches printers - I request the user do a print test.
In the print test I have default data which I feel in the pre-printed form.  I
then make adjustments based on the user's selections.

BTW - this method has worked well for me and is generic for all printers.

Michael

Re:Printing on Pre-Printed Forms


Quote
"Jay Eisenstock" <ca...@ix.netcom.com> wrote:

|I have a need for printing on pre-printed forms. I wrote some code with
|Delphi 2.1 using the Printer.Canvas.TextOut procedure to position the text
|precisely on the form. It works great with an HP LaserJet 5 printer.
|However, when using another printer (a  HP LaserJet II for example), the
|text does not line up on the form.  It starts off okay, but 'drifts' towards
|the end of the page.

Jay,

Just a thought.  How far off is it by the end of the page?  Could it
just be that the printer/s vertical movement is just a bit off?  Since
we abandoned tractor-feed printers, vertical motion is not quite
exact!

Phil

Re:Printing on Pre-Printed Forms


Thanks All!
I have found a lot of helpful information on the web. Of particular help, is
Peter Beyersdorf's DeviceInfo utility available free from him at
www.beyersdorf.com  DeviceInfo tells you the specifics from the Windows
driver of any printer you select. I am now using the Windows API to better
position my forms and in the process of testing with different printers. If
anyone wants specifics about the API or some useful web sites that deal with
printing in Delphi, contact me at ca...@ix.netcom.com

Other Threads