使用Flow Document在PrintDialog上设置打印方向

时间:2011-11-11 00:11:40

标签: c# wpf flowdocument printdialog

只是想知道是否有办法在使用流文档的打印对话框上设置打印文档方向。

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

1 个答案:

答案 0 :(得分:9)

使用:

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

您需要添加对ReachFramework.dllSystem.Printing.dll的引用。