Resizing a PDF with annotations using aspose-pdf 20.7 for Java results in Errors in the resulting file

We’re resizing pdf files to make room for adding a bit of branding at the top and/or bottom of the file. After calling resizeContents() and saving we’re seeing the following error when opening the file in Acrobat Reader.

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

Sample Code:

PdfFileEditor.ContentsResizeParameters parameters = new PdfFileEditor.ContentsResizeParameters(
PdfFileEditor.ContentsResizeValue.units(0),
null,
PdfFileEditor.ContentsResizeValue.units(0),
PdfFileEditor.ContentsResizeValue.units(0),
null,
PdfFileEditor.ContentsResizeValue.units(11)
);
PdfFileEditor editor = new PdfFileEditor();
Document document = new Document(path);
editor.resizeContents(document, parameters);
document.save();

Sample File.zip (201.0 KB)

@cpostlethwait

We were able to notice the issue in our environment while testing the scenario with Aspose.PDF for Java 20.10. Therefore, an issue as PDFJAVA-39931 has been logged in our issue tracking system for the sake of correction. We will further look into its details and keep you posted with the progress of investigation against it. Please be patient and spare us some time.

We are sorry for the inconvenience.

@asad.ali

Is there any update on this issue

@velpukondaramesh

Regretfully, the earlier logged ticket has not been fully investigated yet. As soon as it is analyzed, we will be able to share some news about its fix ETA. We have recorded your concerns and will surely update you as soon as it is resolved. Your patience is highly appreciated in this regard.

We apologize for the inconvenience.

The issues you have found earlier (filed as PDFJAVA-39931) have been fixed in Aspose.PDF for Java 22.4.