I need to bring up a printdialog and have it default to Landscape Orientation and point a file to print to it. How do I do it in c#?

I need to bring up a printdialog and have it default to Landscape Orientation and point a file to print to it.   How do I do it in c#?
cbruneAsked:
Who is Participating?
 
käµfm³d 👽Commented:
Like this?
this.printDialog1.PrinterSettings.DefaultPageSettings.Landscape = true;
this.printDialog1.PrinterSettings.PrintFileName = "somefile.ext";
this.printDialog1.PrinterSettings.PrintToFile = true;

Open in new window

0
 
käµfm³d 👽Commented:
And don't forget  ; )
this.printDialog1.ShowDialog();

Open in new window

0
 
cbruneAuthor Commented:
how do i print the contents of the file???
0
 
Todd GerbertIT ConsultantCommented:
What is it you're trying to print?  If it's a PDF, or text file it's usually much easier to use System.Diagnostics.Process to start Adobe Reader or Notepad and give command line switches to print - though you'll lose some control over the print dialog (actually, printing plain text isn't terribly difficult, but just about anything else will be a bit of a pain in the butt).
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.