Pagesetup (Pagewidth & Pageheight)

Hi

I am trying to create a report on a custom papersize e.g. A5, A3 or even a custom size. I change the pagewidth & pageheight to the correct sizes and then save the report. When I open the pdf document its size is A4. Please find some sample code below.

Dim pdf1 As Pdf = New Pdf

pdf1.PageSetup.PageWidth = 500

pdf1.PageSetup.PageHeight = 500

pdf1.Save(System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\SamplePDF.pdf")

MsgBox("Saved")

OR

Dim pdf1 As Pdf = New Pdf

pdf1.PageSetup.PageWidth = PageSize.A5Width

pdf1.PageSetup.PageHeight = PageSize.A5Height

pdf1.Save(System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\SamplePDF.pdf")

MsgBox("Saved")

How would you suggest I do this

Thanks

Thanks for considering Aspose.

I tried a sample to test page size with A5, the result is correct. So in which way do you judge the page size is A4?

I open the file in Acrobat reader and look at the properties and it will always be 5.85in * 8.26in.

And also items that has been placed at a position outside the bounds of an A4 is being cut of.

I tested with your code and no error is found. Which version are you using? Can you please provide the complete code that can reproduce this error?

I was using version 2.9.5.0 and upgraded to version 2.9.6.0 and its working fine now.

Thanks