I have a ready FixedDocument to be printed with the below pagesize for the user to choose accordingly:
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);
But every time when I print the FixedDocument out via PDFCreator, it always stays as A4 size.
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;
}
What can I do to fix this? Appreciate the help.