We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

New pdf size is different when it generates

Hello,

Aspose version: 20.7.0
Platform : .Net framework 4.8.

I am creating a new pdf from scratch and also set the height and width (Letter page). Width 11 and Height 8.5. But the output pdf is not what I want to create. My ultimate plan is to put one pdf into new pdf by adding my custom header and footer into new pdf.
Can you please help me out to get a pdf in a size (11 x 8.5).
Code -
var newPdf = new Document();
newPdf.PageInfo.Height = 612; // 8.5 // Aspose.Pdf.PageSize.PageLetter.Height;
newPdf.PageInfo.Width = 792; //11 //Aspose.Pdf.PageSize.PageLetter.Width;
newPdf.Pages.Add();
newPdf.Save(“newPDFOutput.pdf”, SaveFormat.Pdf);
newPDF.pdf (1.3 KB)

@shiphelp

Please try to set the size with SetPageSize method and share your feedback with us.

Page page = newPdf.Pages.Add();
page.SetPageSize(792, 612);

Thanks @mudassir.fayyaz for your help. This solution works.