We have a PDF file (sample.pdf (132.2 KB)
) that contains a form filled out by comments. When we call this method resizeContentsWithNormalization of PdfFileEditor to resize the PDF file, following exception occurred: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
** at com.aspose.pdf.Color.lf(Unknown Source)**
** at com.aspose.pdf.Annotation.ld(Unknown Source)**
** at com.aspose.pdf.FreeTextAnnotation.lI(Unknown Source)**
** at com.aspose.pdf.FreeTextAnnotation.lf(Unknown Source)**
** at com.aspose.pdf.Annotation.lI(Unknown Source)**
** at com.aspose.pdf.Annotation.updateAppearances(Unknown Source)**
** at com.aspose.pdf.Annotation.changeAfterResize(Unknown Source)**
** at com.aspose.pdf.facades.APdfFileEditor.resizeContents(Unknown Source)**
** at com.aspose.pdf.facades.PdfFileEditor.resizeContents(Unknown Source)**
** at com.aspose.pdf.facades.APdfFileEditor.resizeContentsWithNormalization(Unknown Source)**
** at com.aspose.pdf.facades.PdfFileEditor.resizeContentsWithNormalization(Unknown Source)**
Although there are exceptions, we still can save the resized PDF file: sample-resized.pdf (126.9 KB)
But the comments seem not being resized too. They look like still in the original positions: sample.png (147.4 KB)
Could you please help us to identify why the exception occurred? and is it possible to resize the comments together?
Please create a simple Java application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing. We will investigate the issue and provide you more information on it.
public class Test {
public static void main(String[] args) {
PdfFileEditor.ContentsResizeParameters parameters = new PdfFileEditor.ContentsResizeParameters(
PdfFileEditor.ContentsResizeValue.units(10),
null,
PdfFileEditor.ContentsResizeValue.units(10),
PdfFileEditor.ContentsResizeValue.units(10),
null,
PdfFileEditor.ContentsResizeValue.units(10)
);
Document pdfDocument = null;
try {
pdfDocument = new Document("sample.pdf");
PdfFileEditor editor = new PdfFileEditor();
editor.resizeContentsWithNormalization(pdfDocument, parameters);
} finally {
if (pdfDocument != null) {
pdfDocument.save("sample-resized.pdf");
pdfDocument.close();
}
}
}
Currently, this issue is pending for analysis and is in the queue. Once we complete the analysis of your issue, we will then be able to provide you an estimate.
The analysis of the ticket has been completed and we will try our best to fix it in 23.5 version of the API that will be released in the end of this month i.e. May 2023. We will let you know once we have more updates in this regard.
Regretfully, the ticket could not get resolved in 23.5 version due to some technical difficulties. Hence the fixed-in version is postponed. We are already trying our best to resolve it as soon as possible. We will surely share updates with you as soon as we have some in this regard. Your patience is highly appreciated. We apologize for the inconvenience.