Hi Lutz,
Thanks for your inquiry. Please note PageInfo property is used for page formatting while creating new PDF document from scratch. However for existing PDF document you need to use Rect property to get dimensions of existing PDF Page. You need to use SetPageSize() method to change page dimensions.
Furthermore, for printing from Aspose.Pdf you need to set PageSettings accordingly, otherwise it will take default page setting of the printer. If there is any different in your requirements and my understanding then please share some more details.
pgs.PaperSize = new System.Drawing.Printing.PaperSize("A3", 1169, 1654);
Best Regards,
Hi Tilal,
Hi Tilal,
Hi Lutz,
Thanks for your feedback. Please amend your code as following, it will help you to accomplish the task. I have tested the code with a soft printer (Adobe PDF) and unable to notice any issue. Please try this and share the results.
foreach (Aspose.Pdf.Page page in doc.Pages)
{
height = (int)(page.Rect.Height / 0.72);
width = (int)(page.Rect.Width / 0.72);
if (page == doc.Pages[1])
{
pageSettings.PaperSize = new PaperSize();
//pageSettings.PaperSize.Width = width;
//pageSettings.PaperSize.Height = height;
pageSettings.PaperSize = new System.Drawing.Printing.PaperSize("A3", width, height);
}
page.SetPageSize(width, height);
}
Best Regards,