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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PDF file generated by PrintDocument code viewing issue

Status
Not open for further replies.

JScannell

Programmer
Jan 9, 2001
306
US
I have a PDF file that is created via the PrintDocument object in my desktop application.
I set the page orientation to be portrait or landscape depending on the needs.
If the user chooses to "Print" to a PDF printer (Cute PDF, Bullzip, Microsoft Print to PDF) the output goes to a PDF file. If the user chooses to print directly to a printer, the output goes to the printer.

I then create the document

Here's the problem:

If the user chooses to "print" to a PDF printer and the user opens the document (in either Acrobat Reader or programmatically using a PDF Viewer form with an embedded AxAcroPDF object that is part of my application), the print dialog always opens with the print orientation Portrait regardless of the setting of the PDF document. If you look at the attached screenshot, you can clearly see that the document is meant to be landscape

Here is a code snippet of how I tell PrintDocument the orientation:

Public oPrintDialog as System.Windows.Forms.PrintDialog = new System.Windows.Forms.PrintDialog ()
Public oPrintDocument as System.Drawing.Printing.PrintDocument = new System.Drawing.Printing.PrintDocument ()

oPrintDialog.PrinterSettings.DefaultPageSettings.Landscape = True
oPrintDialog.PrinterSettings.PrinterName = oPS.strChosenPrinter ' The printer that the user picked
oPrintDialog.PrinterSettings.PrintFileName = strFullPath ' The output file name

oPrintDocument.PrinterSettings = oPrintDialog.PrinterSettings

So, what else do I have to do such that the page orientation that is set in my code can be seen by the PDF viewer??

Thanks in advance,
Jerry


Jerry Scannell
 
 https://files.engineering.com/getfile.aspx?folder=f7e680ce-534f-45f8-81b2-38710126de33&file=PrintOrientation.jpg
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top