2

Just wondering if there is a way to set the print document orientation on a Print Dialog that is using a flow document.

e.g.

var document = userControl.Content as FlowDocument;
var printDialog = new PrintDialog();
if (printDialog.ShowDialog() == true)
{
    var paginator = ((IDocumentPaginatorSource) document).DocumentPaginator;
    paginator.PageSize = new Size(userControl.Width, userControl.Height);

    //Set Orientation Landscape .....


    printDialog.PrintDocument(paginator, PrintDescription);
}
merbla
  • 537
  • 6
  • 14
  • Already answered http://stackoverflow.com/questions/1003585/setting-pageorientation-for-the-wpf-documentviewer-printdialog – merbla Nov 11 '11 at 00:15

1 Answers1

10

Use:

printDialog.PrintTicket.PageOrientation = System.Printing.PageOrientation.Landscape;

You need to add a reference to ReachFramework.dll and System.Printing.dll each.

eeerahul
  • 1,629
  • 4
  • 27
  • 38