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
408 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 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
Comment Utility
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 74

Expert Comment

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

Open in new window

0
 

Author Comment

by:cbrune
Comment Utility
how do i print the contents of the file???
0
 
LVL 33

Expert Comment

by:Todd Gerbert
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

10 Experts available now in Live!

Get 1:1 Help Now