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

Free Support Forum - aspose.com

Some markups are removed on PDF page resize by Aspose.PDF for .NET

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

@mmrusin

Please provide your sample PDF document in a private message by clicking over username and pressing Blue Message button. We will test the scenario in our environment and address it accordingly.

@mmrusin

We have tested the scenario with your privately shared PDF and Aspose.PDF for .NET 20.9. We were able to notice the similar issue. For the sake of correction, we have logged it as PDFNET-48754 in our issue tracking system. We will further look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.