PrintDialogを使用してWPFから印刷する場合、印刷するすべてのページの既定のページの向きのみを設定できます。FixedDocumentを使用しており、ヘッダーやフッターの行など、自分でレイアウトするさまざまなコンテンツ用に複数のページを作成しています。これらのページの一部は横向きである必要があり、他のページは縦向きである必要があります。
単一ページの向きを設定するにはどうすればよいですか?FixedPageクラスはそのようなプロパティを提供しません。
PrintDialogを使用してWPFから印刷する場合、印刷するすべてのページの既定のページの向きのみを設定できます。FixedDocumentを使用しており、ヘッダーやフッターの行など、自分でレイアウトするさまざまなコンテンツ用に複数のページを作成しています。これらのページの一部は横向きである必要があり、他のページは縦向きである必要があります。
単一ページの向きを設定するにはどうすればよいですか?FixedPageクラスはそのようなプロパティを提供しません。
PrintTicket を使用するとどうなりますか?
PrintTicket オブジェクトは、PrintTicket ドキュメントと呼ばれる特定の種類の XML ドキュメントを扱いやすく表現したものです。後者は、さまざまな機能 (両面印刷、部単位印刷、ステープルなど) の設定方法をプリンターに指示する一連の命令です。
まだはっきりとはわかりませんが、ここではページの向きを 1 つずつ変更できるようです。
// 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