Resize a PDF with annotations using Aspose.PDF for .NET - output is damaged due to annotations

Hi,

We are using version 20.3.0 of the Aspose.PDF for .NET component and we are experiencing the following with resizing a PDF that has highlighted text in it.

Resizing the input file lorem-input.zip (86.6 KB) to 5% less using the following code:

        var fileEditor = new PdfFileEditor();

        var parameters = new PdfFileEditor.ContentsResizeParameters(
            PdfFileEditor.ContentsResizeValue.Percents(5),
            null,
            PdfFileEditor.ContentsResizeValue.Percents(5),
            PdfFileEditor.ContentsResizeValue.Percents(5),
            null,
            PdfFileEditor.ContentsResizeValue.Percents(5));

        fileEditor.ResizeContents(document, parameters);

will result in the output lorem-ouput.zip (85.5 KB) that Acrobat Reader (version 20 on a Win 10 machine) will throw the error:

There was an error processing an annotation or link. There was a problem reading this document (16).

Since this looks like problem with annotation not being properly resized, we tried to shake this off by adding the following code post-resizing:

        foreach (var page in document.Pages)
        {
            foreach (var annotation in page.Annotations)
            {
                annotation.Contents = annotation.Contents;
            }
        }

The output document is not longer corrupted in the eyes of Acrobat Reader but the highlighted text is off.

We are looking for both a definitive fix for this but in the mean time we are up for any kind of workaround/suggestion on how to mitigate this.

Best regards,
Alin

@gwert

Thanks for contacting support.

We were able to replicate the issue in our environment and logged it as PDFNET-48157 in our issue tracking system. We are afraid that we cannot offer any reliable workaround at the moment as the issue seems related to resizing content and not preserving annotations. We will surely investigate the issue in details and inform you as soon as we have some definite updates regarding its rectification. Please spare us some time.

We are sorry for the inconvenience.

Is there any update on this issue?

@velpukondaramesh

We are afraid that the earlier logged ticket has not been fully analyzed yet. It is under the phase of investigation at the moment and as soon as we have some news about its fix ETA, we will be sharing updates with you in respective paid support thread.

We apologize for the inconvenience.

The issues you found earlier (filed as PDFNET-48157) have been fixed in Aspose.PDF for .NET 23.1.