We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Crop edge of pdf

I want to crop edge of pdf document, how can I do it with Aspose.pdf product? Thanks in advance

Hi there,

Thanks for your inquiry. You can crop a Pdf document by setting CropBox, accepts a rectangle object. Please check following code snippet for the purpose. Please note point is measuring unit in Aspose.Pdf and 72 points=1 inch.

Document document = new Document(myDir+“Input.pdf”);
//Iterate through All Pages of a PDF Document
for (int i = 1; i <= document.Pages.Count; i++)
Aspose.Pdf.Rectangle cropBox = document.Pages[i].CropBox;
// update page’s crop box
document.Pages[i].CropBox = new Aspose.Pdf.Rectangle(cropBox.LLX + 72, cropBox.LLY + 72, cropBox.URX - 72, cropBox.URY - 72);
// save document

Please feel free to contact us for any further assistance.

Best Regards,