Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print to File 1

Status
Not open for further replies.

furjaw

Programmer
Mar 27, 2006
49
US
Visual Basic 2005 Express Edition:

My application creates a one page report and prints it out. The page includes an image.

Now, I would like to save that page to a file, so, that it could later be retrieved and viewed on the screen and also have the ability to reprint it.




 
Save the file to a PDF seems a good option here.
The easiest way to do this is to install a PDF print driver.

Sweep
...if it works, you know the rest..
Always remember that Google is your friend

curse.gif
 
Sounds good, but, how do I install a PDF print driver?
 
Download CutePDF, to allow the user to select the file location, or else, PDFCreator, which allows you to control it programmatically. Both are FREE and easy to find.

-David
2006 Microsoft Most Valueable Professional (MVP)
2006 Dell Certified System Professional (CSP)
 
The code below got it to create a PDF file, but, it didn't use my .PrintFileName or my .PrintToFile = True.
I want it to create the PDF file without the user having to enter the filename or to have to check the "Print to File" box. In fact, I don't even want a print dialog, I just want PDFCreator to write out the PDF file without the user knowing anything about it. Then, I will do a PrintPreviewDialog() that will ask him if he wants a hard copy.

Dim dlg As New PrintDialog()
dlg.Document = mDoc
With mDoc.PrinterSettings
.PrinterName = ("PDFCreator")
.PrintFileName = (PrintFileName)
.PrintToFile = True
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then
mDoc.Print()
End If
End With
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top