使用PrintDialog从WPF打印时,您只能为要打印的所有页面设置默认页面方向。我正在使用FixedDocument并为我自己布局的不同内容创建多个页面,包括页眉和页脚行。其中一些页面必须是风景,其他页面必须是肖像。
如何设置单个页面的方向? FixedPage类不提供这样的属性。
答案 0 :(得分:0)
使用PrintTicket怎么样?
PrintTicket对象是一种易于使用的表示形式 某种类型的XML文档称为PrintTicket文档。后者 是一组说明告诉打印机如何设置其各种 功能(如双面打印,整理和装订)。
我还没有清楚的看法,但是这里似乎可以逐一改变页面的方向:
// Use different PrintTickets for different FixedDocuments.
PrintTicket ptFD = new PrintTicket();
if (_firstDocumentPrintTicket <= 1)
{ // Print the first document in black/white and in portrait
// orientation. Since the PrintTicket at the
// FixedDocumentSequence level already specifies portrait
// orientation, this FixedDocument can just inherit that
// setting without having to set it again.
ptFD.PageOrientation = PageOrientation.Portrait;
ptFD.OutputColor = OutputColor.Monochrome;
_firstDocumentPrintTicket++;
}
else // if (_firstDocumentPrintTicket > 1)
{ // Print the second document in color and in landscape
// orientation. Since the PrintTicket at the
// FixedDocumentSequence level already specifies portrait
// orientation, this FixedDocument needs to set its
// PrintTicket with landscape orientation in order to
// override the higher level setting.
ptFD.PageOrientation = PageOrientation.Landscape;
ptFD.OutputColor = OutputColor.Color;
}
http://msdn.microsoft.com/en-us/library/system.printing.pageorientation.aspx