Problems with fields having multiple appearances

Hello, there is a sample PDF with field “FIELD2” appearing 3 times in document. How we can get all field’s appearances? We tried Field.size(), but it returns 0. Also, when field created dynamically with Form.add method and then addFieldAppearance called multiple times, Field.size() returns correct value.


Sample code and PDF attached. PDF created with Foxit PhantomPDF 6.2.1.0618. We used Aspose.PDF 11.7.0

Hi John,


Thanks for your inquriy. I have tested the scenario with your shared PDF document and noticed the reported issue, so logged a ticket PDFJAVA-36062 in our issue tracking system for further investigation and rectification.

We are sorry for the inconvenience.

Best Regards,

Any progress on this?

Hi John,


Thanks for your inquiry. I am afraid the your above reported issue is still pending for investigation, as currently our product team is busy in resolving other issues in the queue. We will notify you as soon as we made some significant progress towards issue resolution.

We are sorry for the inconvenience.

Best Regards,

Hi John,

Thanks for your patience.

We have further investigated earlier reported PDFJAVA-36062 and in order to resolve this problem, please try using following code snippet.

[Java]

Document pdf = new Document(myDir + "input.pdf");
System.out.println(pdf.getPages().get_Item(1).getAnnotations().size());

for (Annotation a : (Iterable) pdf.getPages().get_Item(1).getAnnotations()) {
    System.out.println("Annot Name: " + a.getFullName() + " Rect: " + a.getRect());
}

The output will be

4
Annot Name: FIELD1 Rect: 50.25,697.5,162,731.25
Annot Name: FIELD2 Rect: 177,693.75,334.5,733.5
Annot Name: FIELD2 Rect: 177,642.75,334.5,682.5
Annot Name: FIELD2 Rect: 177.75,588.75,335.25,628.5