Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed May 03, 2023 3:16 pm

I have a PDF that is 17x11(Ledger) that I want to silent print. If I send it to one printer, it prints perfectly without any PaperSize being set. If I send it to another, which is the same model of printer, it's on Letter paper and it's not in color. I have tried to specify papersize, but it is ignored. I tried to specify tray, but the printers don't seem to like that. I get an error saying the page size and the tray don't match, but the tray is the 11x17 tray. I have tried setting the paper size to Ledger and Letter11x17, and it tries to print to the manual feed tray for some reason and it then ignores it if I tell it to try tray #2. These are Brother brand printers, relatively new. It also does not work on a Ricoh printer.

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.

CSherman
 
Posts: 1
Joined: Wed May 03, 2023 2:18 pm

Thu May 04, 2023 6:41 am

Hi,

Thanks for your message.
As for your issue, we first suggest that you use our latest version(Spire. PDF Pack (Hot Fix) Version: 9.4.12)to test the following code
Code: Select all
            doc.PrintSettings.PaperSize= new System.Drawing.Printing.PaperSize("Ledger", ((int)PdfPageSize.Ledger.Width) / 72 * 100,
           ((int)PdfPageSize.Ledger.Height) / 72 * 100); 
            doc.PrintSettings.SelectSinglePageLayout(PdfSinglePageScalingMode.FitSize, true);
            doc.Print();

If there is still any issue after testing, please provide us with the following information for further investigation.
1. Your input document,which you can upload them here or provide to us by email ([email protected])
2. Your system information (E.g. Win10, 64 bit) and regional settings (E.g. China, Chinese).

Best Regards,
Herman
E-iceblue support team
User avatar

Herman.Yan
 
Posts: 115
Joined: Wed Mar 08, 2023 2:00 am

Return to Spire.PDF

cron