Java Code Examples for org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget#getPage()
The following examples show how to use
org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget#getPage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RemoveField.java From testarea-pdfbox2 with Apache License 2.0 | 5 votes |
void removeWidgets(PDField targetField) throws IOException { if (targetField instanceof PDTerminalField) { List<PDAnnotationWidget> widgets = ((PDTerminalField)targetField).getWidgets(); for (PDAnnotationWidget widget : widgets) { PDPage page = widget.getPage(); if (page != null) { List<PDAnnotation> annotations = page.getAnnotations(); boolean removed = false; for (PDAnnotation annotation : annotations) { if (annotation.getCOSObject().equals(widget.getCOSObject())) { removed = annotations.remove(annotation); break; } } if (!removed) System.out.println("Inconsistent annotation definition: Page annotations do not include the target widget."); } else { System.out.println("Widget annotation does not have an associated page; cannot remove widget."); // TODO: In this case iterate all pages and try to find and remove widget in all of them } } } else if (targetField instanceof PDNonTerminalField) { List<PDField> childFields = ((PDNonTerminalField)targetField).getChildren(); for (PDField field : childFields) removeWidgets(field); } else { System.out.println("Target field is neither terminal nor non-terminal; cannot remove widgets."); } }
Example 2
Source File: DetermineWidgetPage.java From testarea-pdfbox2 with Apache License 2.0 | 4 votes |
int determineFast(PDDocument document, PDAnnotationWidget widget) { PDPage page = widget.getPage(); return page != null ? document.getPages().indexOf(page) : -1; }
Example 3
Source File: CheckImageFieldFilled.java From testarea-pdfbox2 with Apache License 2.0 | 4 votes |
WidgetImageChecker(PDAnnotationWidget widget) { super(widget.getPage()); this.widget = widget; }