Free Support Forum -

Unable to Apply Margin properties to a pdf using Aspose pdf

Hi Team,
I am trying to make Some Margin property changes to an existing pdf using Aspose pdf those changes are not reflecting.Please find my pdf attchment

Thanks, (85.8 KB)


Thank you for contacting support.

We would like to share with you that changing page margins to existing PDF does not affect present content. The margins are effective for new content. However, you may resize contents of a PDF page by using below code snippet in your environment.

        Document doc = new Document(dataDir + "sample.pdf");
        var fileEditor = new Aspose.Pdf.Facades.PdfFileEditor();
        var parameters = new Aspose.Pdf.Facades.PdfFileEditor.ContentsResizeParameters(Aspose.Pdf.Facades.PdfFileEditor.ContentsResizeValue.Units(10), null, Aspose.Pdf.Facades.PdfFileEditor.ContentsResizeValue.Units(10), Aspose.Pdf.Facades.PdfFileEditor.ContentsResizeValue.Units(10), null, Aspose.Pdf.Facades.PdfFileEditor.ContentsResizeValue.Units(10));
        fileEditor.ResizeContents(doc, parameters);
        doc.Save(dataDir + "Resize_18.10.pdf");

We hope this will be helpful. Please feel free to contact us if you need any further assistance.