merbla
merbla

Reputation: 547

Set Print Orientation on PrintDialog using Flow Document

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);
}

Upvotes: 2

Views: 6618

Answers (1)

Stalin Pimentel
Stalin Pimentel

Reputation: 101

Use:

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

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

Upvotes: 10

Related Questions