The PDFEditor.ResizeContent moves the “view” window when resizing the PDF.
Source document:
document.pdf (95.8 KB)
The result document:
document_out.pdf (97.2 KB)
We are trying to resize the doc to have a 0.5-inch border on each side to draw the frame. However, the result PDF has no left border and the view area is moved (blue crosses appears on the page)
Source code:
public static void resizeDocument(Document document, double units)
{
PdfFileEditor.ContentsResizeValue valueUnits = PdfFileEditor.ContentsResizeValue.Units(units);
PdfFileEditor pdfEditor = new Aspose.Pdf.Facades.PdfFileEditor();
PdfFileEditor.ContentsResizeParameters resizeParameters = new PdfFileEditor.ContentsResizeParameters()
{
TopMargin = valueUnits, LeftMargin = valueUnits, RightMargin = valueUnits, BottomMargin = valueUnits
};
pdfEditor.ResizeContents(document, resizeParameters);
}
static void Main(string[] args)
{
Document document = new Document("document.pdf");
resizeDocument(document, 36);
document.Save("document_out.pdf");
}