Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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#?

Posted on 2011-03-16
4
423 Views
Last Modified: 2012-05-11
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#?
0
Comment
Question by:cbrune
  • 2
4 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 35151681
Like this?
this.printDialog1.PrinterSettings.DefaultPageSettings.Landscape = true;
this.printDialog1.PrinterSettings.PrintFileName = "somefile.ext";
this.printDialog1.PrinterSettings.PrintToFile = true;

Open in new window

0
 
LVL 75

Expert Comment

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

Open in new window

0
 

Author Comment

by:cbrune
ID: 35151863
how do i print the contents of the file???
0
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 35168506
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

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question