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

Create Pdf without Margin

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?

3 Replies

PV Prakash Viswanathan Syncfusion Team 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.  

Prakash V 

JU Judith 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;

PV Prakash Viswanathan Syncfusion Team 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.  

Prakash V 

Live Chat Icon For mobile
Up arrow icon