Click to See Complete Forum and Search --> : how to make a *.prn file?


chen1207
September 2nd, 2001, 07:44 PM
A .prn file is just a dump of what is sent to the printer when we ask the computer to print, so i think there should be some win32API functions to do that. i know how to print a *.prn file, just use these printer spooler function as follows:
openprinter
startdocprinter
StartPagePrinter
writeprinter
EndPagePrinter
EndDocPrinter
ClosePrinter

the problem is how i can make a standard *.prn file with win32 API and save to disk, so i can call a general procedure to print it at appropriate time?

d.paulson
September 2nd, 2001, 10:31 PM
I don't know about API, but you could 'Add New Printer' and when it asks for which port, pick 'FILE:'. It will ask you for a file name each time you print to this printer. I tried it out setting up a 'GENERIC/TEXT ONLY' and the .prn file seems to be just a text file with the .prn extention. I would think you could just create this file with an 'OPEN xxx.prn for OUTPUT AS #1' and print to it.

David Paulson

chen1207
September 3rd, 2001, 04:58 AM
thanks for your help.
but how to "add new printer" and set the printer port as "FILE" with VB?
and, if i want to printer a picturebox's content which can implement with printer object as :
printer.paintpicture picturebox1.picture, ...
but i can't print it to a file.


chen1207