ユーザーがそれに応じて選択できるように、以下のページサイズで印刷する準備ができた FixedDocument があります。
if (Globals.LayoutSettings.paperSize.ToUpper() == "LETTER")
doc.DocumentPaginator.PageSize = new System.Windows.Size(8.5 * 96, 11 * 96);
else if (Globals.LayoutSettings.paperSize.ToUpper() == "A4")
doc.DocumentPaginator.PageSize = new System.Windows.Size(8.3 * 96, 11.7 * 96);
else
doc.DocumentPaginator.PageSize = new System.Windows.Size(8.5 * 96, 11 * 96);
しかし、PDFCreator を介して FixedDocument を印刷するたびに、常に A4 サイズのままになります。
private bool printDocument(FixedDocument doc)
{
bool printed = false;
try
{
System.Windows.Controls.PrintDialog pd = new System.Windows.Controls.PrintDialog();
//pd.PrintDocument(((IDocumentPaginatorSource)doc).DocumentPaginator, "TempLabel_" + DateTime.Now.Ticks.ToString());
pd.PrintDocument(doc.DocumentPaginator, "TempLabel_" + DateTime.Now.Ticks.ToString());
printed = true;
}
catch (Exception ex)
{
MessageBox.Show("Error in printing document: " + ex.ToString(), "Error in printing");
}
return printed;
}
これを修正するにはどうすればよいですか? 助けに感謝します。