我有一个现成的 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;
}
我能做些什么来解决这个问题?感谢帮助。