Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
Medium Priority
?
442 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
[X]
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
  • 2
4 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Loops Section Overview

610 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