We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Page settings changes when importing another PDF document

I am building a report using the PDF library (10.3.0.43).

For each page in my report, I am importing another PDF document. This works fine, except that I am losing the margins when I am importing from the other document.

My code is like this

PdfDocument document = new PdfDocument();

PdfPage firstPage = document.Pages.AddPage();
// Do something with this page...works fine...

PdfLoadedDocument loadedDocument = new PdfLoadedDocument(fileName);

document.Append(loadedDocument);
// Another document is appended...works fine

PdfPage nextPage = document.Pages.AddPage();
// Do something with this page...works almost fine, but this page appears with no margins

loadedDocument.Close();

Appreciate your help.

Best regards
Svein Erik

1 Reply

GM Geetha M Syncfusion Team October 8, 2012 03:49 AM UTC

Hi Svein,

Thank you for your interest in Syncfusion products.

I was able to see that the page appears without margin. This is because, while importing the document, the margins are set to 0. To solve it, please add a new section before creating a page. This will retain the margin. Following is the code snippet:

PdfSection section = document.Sections.Add();

PdfPage page = document.Pages.Add();

Please try this and let us know if you have any questions.

Regards

Geetha


Loader.
Live Chat Icon For mobile
Up arrow icon