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
417 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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
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!
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

815 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now