Board index » delphi » How to 'print to file'?

How to 'print to file'?

In D1, I want to 'print to file' using a series of GDI calls.  I enable the
print to file checkbox on the printer setup dialog, and can test it.  Duh.
What do I do to actually send the printed output to a file ready to be
processed by the appropriate printer?  So, if printer type is postscript I
eventually want a postscript file.

Should be easy, but its no where in the help files.  None of the documentation
I have looked through tells me either.....

Thanks, Brad
BEVERNON

 

Re:How to 'print to file'?


In article <1998052017162300.NAA16...@ladder01.news.aol.com>, bever...@aol.com

Quote
(BEVERNON) writes:
>In D1, I want to 'print to file' using a series of GDI calls.  I enable the
>print to file checkbox on the printer setup dialog, and can test it.  Duh.
>What do I do to actually send the printed output to a file ready to be
>processed by the appropriate printer?  So, if printer type is postscript I
>eventually want a postscript file.

>Should be easy, but its no where in the help files.  None of the
>documentation
>I have looked through tells me either.....

Looking at Printers.pas, TPrinter.BeginDoc ends up calling Windows StartDoc
with a TDocInfo (equivalent to windows DOCINFO) structure. This contains a
lpszOutput which BegiunDoc fills with nil (thus sending the output to the
printer device specified). If this is set to point to a file path & name the
output is sent to that file as a print-file.

You might have to replace BeginDoc with your own procedure which sets
DocInfo.lpszOutput to point to your print-file.

Hope this helps

Alan Lloyd
alangll...@aol.com

Other Threads