Class AcroFormOrphanWidgetsProcessor
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.fixup.processor.AbstractProcessor
-
- org.apache.pdfbox.pdmodel.fixup.processor.AcroFormOrphanWidgetsProcessor
-
- All Implemented Interfaces:
PDDocumentProcessor
public class AcroFormOrphanWidgetsProcessor extends AbstractProcessor
Generate field entries from page level widget annotations if there AcroForm /Fields entry is empty.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.commons.logging.Log
LOG
-
Fields inherited from class org.apache.pdfbox.pdmodel.fixup.processor.AbstractProcessor
document
-
-
Constructor Summary
Constructors Constructor Description AcroFormOrphanWidgetsProcessor(PDDocument document)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addFontFromWidget(PDResources acroFormResources, PDAnnotation annotation)
Add font resources from the widget to the AcroForm to make sure embedded fonts are being used and not added by ensureFontResources potentially using a fallback font.private void
ensureFontResources(PDResources defaultResources, PDVariableText field)
private void
handleAnnotations(PDAcroForm acroForm, PDResources acroFormResources, java.util.List<PDField> fields, java.util.List<PDAnnotation> annotations, java.util.Map<java.lang.String,PDField> nonTerminalFieldsMap)
void
process()
private void
resolveFieldsFromWidgets(PDAcroForm acroForm)
private PDField
resolveNonRootField(PDAcroForm acroForm, COSDictionary parent, java.util.Map<java.lang.String,PDField> nonTerminalFieldsMap)
-
-
-
Constructor Detail
-
AcroFormOrphanWidgetsProcessor
public AcroFormOrphanWidgetsProcessor(PDDocument document)
-
-
Method Detail
-
process
public void process()
-
resolveFieldsFromWidgets
private void resolveFieldsFromWidgets(PDAcroForm acroForm)
-
handleAnnotations
private void handleAnnotations(PDAcroForm acroForm, PDResources acroFormResources, java.util.List<PDField> fields, java.util.List<PDAnnotation> annotations, java.util.Map<java.lang.String,PDField> nonTerminalFieldsMap)
-
addFontFromWidget
private void addFontFromWidget(PDResources acroFormResources, PDAnnotation annotation)
Add font resources from the widget to the AcroForm to make sure embedded fonts are being used and not added by ensureFontResources potentially using a fallback font.- Parameters:
acroFormResources
- AcroForm default resources, should not be null.annotation
- annotation, should not be null.
-
resolveNonRootField
private PDField resolveNonRootField(PDAcroForm acroForm, COSDictionary parent, java.util.Map<java.lang.String,PDField> nonTerminalFieldsMap)
-
ensureFontResources
private void ensureFontResources(PDResources defaultResources, PDVariableText field)
-
-