I'm evaluating Spire.PDF but is having a bit of a problem printing PDF files containing A3 pages. The problem is that it always comes out as A4.
I found some code (the commented part below) that is supposed to try and pick a usable size, but the last attempt ignores the size of the PDF and just tries to print it as an A3, and fails.
But whatever I do, I only get A4 printed. I have tried it on multiple A3-capable printes both new and old.
The following code is an excerpt of what I am using in the test environment today.
- Code: Select all
Spire.Pdf.PdfDocument doc = new Spire.Pdf.PdfDocument();
doc.LoadFromStream(stream);
doc.PrintSettings.PrinterName = printerName;
if (pages != null && pages.Length > 0)
doc.PrintSettings.SelectSomePages(pages);
//SizeF size = doc.Pages[0].Size;
//PaperSize paper = new PaperSize("Custom", (int)size.Width, (int)size.Height);
//paper.RawKind = (int)PaperKind.Custom;
//doc.PrintDocument.DefaultPageSettings.PaperSize = paper;
PaperSize paper = new PaperSize("A3", (int)PdfPageSize.A3.Width, (int)PdfPageSize.A3.Height);
paper.RawKind = (int)PaperKind.A3;
doc.PrintDocument.DefaultPageSettings.PaperSize = paper;
doc.PageScaling = PdfPrintPageScaling.ActualSize;
doc.Print();
doc.Dispose();
There's nothing wrong with the PDF files. Printing them manually in Adobe Acrobat, or similar, works just fine.
Thankful for any help.