Issues of resizing PDF comments (resizeContentsWithNormalization)

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?

@Rich_Yu

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.

Hi, following is the source code:

import com.aspose.pdf.Document;
import com.aspose.pdf.facades.PdfFileEditor;

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();
		}
	}
}

}

@Rich_Yu

We have logged this problem in our issue tracking system as PDFJAVA-42068. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@tahir.manzoor can you please let us know is this is resolved?

@aweech

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.

Hello @tahir.manzoor, can you tell us if the analysis has been completed?

@aweech

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.

Hi @asad.ali was this PDFJAVA-42068 included in the 23.5 release? I did not see it mentioned in the notes.

@aweech

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.

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