Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

PDF file generated by PrintDocument code viewing issue

PDF file generated by PrintDocument code viewing issue

PDF file generated by PrintDocument code viewing issue

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 Scannell

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close