Neeraj Khajanchi

Neeraj Khajanchi

  • NA
  • 12
  • 15.4k

WPF: Set Printing Orientation to Landscape?

Aug 15 2017 3:58 AM
In WPF C#, how can I set printer page settings to landscape. I am trying to print a flowdocument. I have tried different things but nothing seems to be working.
 
Here is my code.
  1. IDocumentPaginatorSource dps = this.MyFlowDoc;  
  2. // pd.PrintTicket.PageOrientation = System.Printing.PageOrientation.Landscape;  
  3. // pd.PrintTicket.PageMediaSize = new System.Printing.PageMediaSize(System.Printing.PageMediaSizeName.ISOA4Rotated);  
  4.   
  5. pd.PrintQueue.CurrentJobSettings.CurrentPrintTicket.PageOrientation = System.Printing.PageOrientation.Landscape;  
  6. pd.PrintDocument(dps.DocumentPaginator, "MyInvoice");  

Answers (1)