I tried a code snippet from the forum to resize the document pages to 11x17 just in case it was somehow reading it as Letter, but that did not resolve the problem.
The code below prints the contents landscape at 17x11 cropped off on Letter-sized paper.
- Code: Select all
PdfDocument doc = new PdfDocument(sFile);
////Handle Tray
//if (int.TryParse(Tray, out t))
//{
// _CurrentTray = t;
// doc.PrintSettings.PaperSettings += delegate (object sender1, PdfPaperSettingsEventArgs ev)
// {
// if (ev.PaperSources.Length > 0)
// {
//if (ev.PaperSources.Length >= 2)
//{
// ev.CurrentPaperSource = ev.PaperSources[2];
//}
//else
//{
// ev.CurrentPaperSource = ev.PaperSources[0]; //Default
//}
// }
// };
//}
doc.PrintSettings.PrinterName = sPrinter;
doc.PrintSettings.Color = isColor;
doc.PrintSettings.Landscape = isLandscape;
doc.PrintSettings.Copies = copies;
doc.PrintSettings.PaperSize("Ledger", (int)PdfPageSize.Ledger.Width, (int)PdfPageSize.Ledger.Height); //Also tried pageSize.RawKind= PaperKind.Ledger
doc.PrintSettings.SelectSinglePageLayout(PdfSinglePageScalingMode.ActualSize,false);
doc.Print();
Any ideas? It seems like it's not able to determine which paper source to use based on the paper size, but is complaining when I try to specify the tray.