Margin issues for pdf

Hi Team,

I added a page in a pdf. I tried to change the margins for that particular page but i am not able to do so. Is there any way in aspose.pdf where i can change the margins for a particular page in a pdf doc.

Best,
Ishi

@dewan.ishi

Thank you for contacting support.

You can set page margins as in the code snippet below:

Aspose.Pdf.Document doc = new Aspose.Pdf.Document();
Page page = doc.Pages.Add();

//set margins
MarginInfo marginInfo = new MarginInfo();
marginInfo.Left = 40;
marginInfo.Right = 40;
marginInfo.Top = 40;
marginInfo.Bottom = 40;

page.PageInfo.Margin = marginInfo;

We hope this will be helpful. Please ensure using Aspose.PDF for .NET 18.7 in your environment. In case you face any problem, please feel free to contact us.

Thank you i was able to figure out the same. Thank you for all the help ! :slight_smile:

@dewan.ishi

We are glad to know that your issue has been resolved. Please feel free to contact us in event of any further query.