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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Create Pdf without Margin

Thread ID:

Created:

Updated:

Platform:

Replies:

148208 Oct 10,2019 05:37 AM UTC Oct 11,2019 08:31 AM UTC WinForms 3
loading
Tags: PDF
Judith
Asked On October 10, 2019 05:37 AM UTC

I want to create a Pdf Document without any Margin.
I set document.PageSettings.Margins.All= 0, but t i have always a margin by about 1 cm.

How can i solve the problem?


Prakash Viswanathan [Syncfusion]
Replied On October 11, 2019 07:32 AM UTC

Hi Judith, 

Thank you for contacting Syncfusion support.  

We have checked the reported margin issue, but it is properly set to zero when creating PDF document. We have attached a simple sample, which creates PDF document with zero margin and draw the text in top left of the page. It does not adds any margin in the created document. Please find the sample and output document from below link, 

Kindly try the above sample and let us know the result, if still you are facing the same problem, kindly share us the complete code snippet and output PDF document to us. This will be helpful for us to analyze and assist you further on this.  

Regards, 
Prakash V 


Judith
Replied On October 11, 2019 07:54 AM UTC

Ok, thank you I have found my problem.

My settings:

//Create a new PDF document.

            PdfDocument document = new PdfDocument();
          //Add a page to the document.

            PdfPage page = document.Pages.Add();
            // Set the page size.

            document.PageSettings.Margins.All = 0;


Prakash Viswanathan [Syncfusion]
Replied On October 11, 2019 08:31 AM UTC

Hi Judith, 

Thank you for the update.  

We need to set the page settings before adding the page to the PdfDocument, otherwise the default page setting will be used for the added page.  

Please let us know if you need any further assistance on this.  

Regards, 
Prakash V 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon