We need to resize a PDF in order to add a frame and logo on top of other elements, however, the resizing changes the content of the document.
A part of the original document:
image.png (12.6 KB)
Resized part:
ResizedPart.png (8.6 KB)
Here is the code:
static void Main(string[] args)
{
Document pdfDocument = new Document(“document.pdf”);
PdfFileEditor pdfEditor = new PdfFileEditor();
PdfFileEditor.ContentsResizeParameters resizeParameters = new PdfFileEditor.ContentsResizeParameters()
{
TopMargin = PdfFileEditor.ContentsResizeValue.Units(72),
LeftMargin = PdfFileEditor.ContentsResizeValue.Units(72),
RightMargin = PdfFileEditor.ContentsResizeValue.Units(72),
BottomMargin = PdfFileEditor.ContentsResizeValue.Units(72)
};
pdfEditor.ResizeContents(pdfDocument, new int[] { 1 }, resizeParameters);
pdfDocument.Save("document_resized.pdf");
}
We can repro the issue on both versions 11.3.0 (our licensed version) and 20.8.0.0 (most recent, trial).
We are ready to provide a full PDF, however don’t want it to be available for a public