Free Support Forum - aspose.com

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.