We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

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.