Free Support Forum - aspose.com

Custom Page size doesn't work

I'm using a web application (Asp.net C# with .net framawork 3.5 ) I need to create a report (Aspose.Pdf version 3.1.4.0) with a custom page size, but it doesn't work.

See the code:

Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();

pdf.PageSetup.PageHeight = 13.8F;

pdf.PageSetup.PageWidth = 21F;

//pdf.PageSetup.PageWidth = PageSize.A5Width; IT DOESN'T WORK TOO

//pdf.PageSetup.PageHeight = PageSize.A5Height; IT DOESN'T WORK TOO

Aspose.Pdf.Section sec = new Aspose.Pdf.Section();

for (int i = 0; i <= 100;i++ )

{

sec.Paragraphs.Add(new Text("Hi, this custom pagesize doesn't work! "));

}

pdf.Sections.Add(sec);

pdf.Save(@"C:\TMP\SamplePDF.pdf");

==============================================================================

The page size after saved the document is A4. See the document in the attached file.

WHAT I CAN DO SO SOLVE THE PROBLEM? I need to configure some thing in the control panel ?

HELP ME PLEASE !!!!!!!!!!!!!!!!!

I find solution by my self. I need to set the Section PageInfo class.

See the code:

Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();

Aspose.Pdf.Section sec = new Aspose.Pdf.Section();

sec.PageInfo.PageHeight = 300;

sec.PageInfo.PageWidth = 700;

for (int i = 0; i <= 100;i++ )

{

sec.Paragraphs.Add(new Text("Hi, this custom pagesize works Perfect! "));

}

pdf.Sections.Add(sec);

pdf.Save(@"C:\TMP\SamplePDF.pdf");

==========================================================

I sugest to Aspose Staff to correct documentation

[]'s

Ebenezer Curvello

Hello Ebenezer,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I am not sure where you have been misguided to incorrect information over the documentation. As I can see, the information for setting page size & Margin is correct. Please check following link Set Page Size and Margins.

Can you please do us a favor, and point out the location where, the information is not correct.