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.
Unfortunately, activation email could not send to your email. Please try again.

Page settings changes when importing another PDF document

Thread ID:

Created:

Updated:

Platform:

Replies:

105369 Oct 5,2012 05:23 AM Oct 7,2012 11:49 PM WPF 1
loading
Tags: PDF
Svein Erik Hopen
Asked On October 5, 2012 05:23 AM

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

Geetha M [Syncfusion]
Replied On October 7, 2012 11:49 PM

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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;