Free Support Forum - aspose.com

How to decrease the space from top of a PDF documants?

Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
Aspose.Pdf.Generator.MarginInfo marginInfo = new Aspose.Pdf.Generator.MarginInfo();
marginInfo.Top = 0;
marginInfo.Bottom = 50;
marginInfo.Left = 50;
marginInfo.Right = 50;

How to decrease the space from top of a PDF documents? I used the above code but still there are unnecessary white space in top and bottom of PDF.

Need help…

Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
Aspose.Pdf.Generator.MarginInfo marginInfo = new Aspose.Pdf.Generator.MarginInfo();
marginInfo.Top = 0;
marginInfo.Bottom = 50;
marginInfo.Left = 50;
marginInfo.Right = 50;
sec1.PageInfo.Margin = marginInfo;

How to decrease the space from top of a PDF documents? I used the above code but still there are unnecessary white space in top and bottom of PDF.

Need help…

Hi Arunava,

After creating the MarginInfo object, please assign it to Section object. Please try using following code line. I have tested the scenario with Aspose.Pdf for .NET 6.2.0 and I am unable to notice any issue. In case you have any further query, please feel free to contact. We are sorry for this inconvenience.

//Assign the marginInfo instance to Margin property of sec1.PageInfo
sec1.PageInfo.Margin = marginInfo;

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Please see the below post for a reply to your query.

Thank You & Best Regards,