CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2001
    Posts
    8

    how to make a *.prn file?

    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?










  2. #2
    Join Date
    Jan 2000
    Location
    Saskatchewan, Canada
    Posts
    595

    Re: how to make a *.prn file?

    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


  3. #3
    Join Date
    Aug 2001
    Posts
    8

    Re: how to make a *.prn file?

    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




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured