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

Free Support Forum - aspose.com

Problems with PDF PageSize


I'm attempting to create a PDF document. My problem is that it seems that I can't properly set the page size. I'm using VB.Net (Visual Studio 2005), with code like the following...

Dim pdf As New Aspose.Pdf.Pdf()
Dim license As New Aspose.Pdf.License
pdf.PageSetup.PageHeight = Aspose.Pdf.PageSize.LetterHeight
pdf.PageSetup.PageWidth = Aspose.Pdf.PageSize.LetterWidth

Dim section As New Aspose.Pdf.Section()
section.Paragraphs.Add(New Aspose.Pdf.Text("Test"))
pdf.Save("TestDocuement.pdf", Aspose.Pdf.SaveType.OpenInAcrobat, Response)

When I view the page in Adobe Reader 7.0, and if I look at Document Properties, the page size is always 8.26 x 11.69 inches. I have played around with other values for the pageheight and pagewidth, but it doesn't seem to make any difference. This screws up the margins and the display. What I really want is 8.5 x 11 inches.

My Aspose.Pdf.dll is dated 4/3/2006 and file properties indicates file version 2.9.6.

Any thoughts or recommendations?

Dave Yancey


Thank you for considering Aspose

I am not sure about this issue, I will ask the developer to check this issue and will let you know as soon as solution is found.


Hi Dave,

In Aspose.Pdf page size can be set per section. So you can set the page size for the section object. If you want the section to have the same page size with the Pdf document, please write your code like the following:

Dim section As Aspose.Pdf.Section = New Aspose.Pdf.Section(pdf)

So that the section can inherit the page setting of the document.