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

Free Support Forum - aspose.com

Page level dimension changes are ignored if Document level dimensions are set

If any page dimension or orientation settings are set at the document level, any changes made to those settings for an individual page are ignored. This is true regardless of whether I use Page.SetPageSize() or Page.PageInfo.Height/.Width.

Is this the way it’s supposed to work? It seems wrong. I would have expected that the Document.PageInfo settings were defaults, used for a page only if nothing is set specifically for that page.

Please advise.

Here is a code sample demonstrating the issue. To prove the point, after running once, if you comment out the three lines beginning with “doc.PageInfo.” and re-run, the individual pages are rendered as expected.

//ISSUE: setting Document.PageInfo dimension/orientation properties
// causes any changes to these properties for an individual page to
// be ignored
var doc = new Document();

//set PageInfo settings at the Document level
doc.PageInfo.IsLandscape = true;
doc.PageInfo.Height = 700;
doc.PageInfo.Width = 350;

//RESULT: changes to Page.PageInfo.Height/Width are ignored, apparently
// because Document.PageInfo dimensions are set
var page = doc.Pages.Add();
page.Paragraphs.Add(new TextFragment(
“setting height/width properties…result should be 200h x 600w”));
page.PageInfo.Height = 200;
page.PageInfo.Width = 600;

//RESULT: SetPageSize() is ignored, apparently because Document.PageInfo
// dimensions are set
page = doc.Pages.Add();
page.Paragraphs.Add(new TextFragment(
“use SetPageSize()…results should be 200h x 600w”));
page.SetPageSize(600, 200);

//save and done

R. Ernst

Hi Ernst,

We are sorry for the inconvenience caused. While testing the scenario with the latest version of Aspose.Pdf for .NET 9.5.0, we have managed to reproduce the reported issue and logged it in our bug tracking system as PDFNEWNET-37323 for further investigation and resolution. We will notify you via this thread as soon as it is resolved.

Please feel free to contact us for any further assistance.

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-37323) have been fixed in Aspose.Pdf for .NET 9.6.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.