Package com.openhtmltopdf.pdfboxout
Class PdfBoxForm
- java.lang.Object
-
- com.openhtmltopdf.pdfboxout.PdfBoxForm
-
public class PdfBoxForm extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PdfBoxForm.CheckboxStyle
static class
PdfBoxForm.Control
private static class
PdfBoxForm.ControlFontPair
private static class
PdfBoxForm.Field
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,PdfBoxForm.Field>
allFieldMap
private java.util.List<PdfBoxForm.ControlFontPair>
controls
private PdfBoxPerDocumentFormState
docFormsStateContainer
private org.w3c.dom.Element
element
private PdfBoxOutputDevice
od
private java.util.Map<java.lang.String,java.util.List<PdfBoxForm.Control>>
radioGroups
private java.util.List<PdfBoxForm.Control>
submits
-
Constructor Summary
Constructors Modifier Constructor Description private
PdfBoxForm(org.w3c.dom.Element element, PdfBoxPerDocumentFormState forms, PdfBoxOutputDevice od)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addControl(PdfBoxForm.Control ctrl, java.lang.String fontName)
static org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream
createCheckboxAppearance(PdfBoxForm.CheckboxStyle style, org.apache.pdfbox.pdmodel.PDDocument doc, org.apache.pdfbox.pdmodel.PDResources resources)
Creates a checkbox appearance stream.static org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream
createCheckboxAppearance(java.lang.String appear, org.apache.pdfbox.pdmodel.PDDocument doc, org.apache.pdfbox.pdmodel.PDResources resources)
static PdfBoxForm
createForm(org.w3c.dom.Element e, PdfBoxPerDocumentFormState forms, PdfBoxOutputDevice od)
private void
createNonTerminalFields(PdfBoxForm.Field f, org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm form)
This method will create the non terminal fields.private void
createNonTerminalFields(org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm form)
Calls createNonTerminalFields on all root non-terminal fields.private static java.lang.String
getColorOperator(FSColor color)
Get a PDF graphics operator for a specific color.private org.apache.pdfbox.cos.COSString
getCOSStringUTF16Encoded(java.lang.String value)
private java.lang.String
getTextareaText(org.w3c.dom.Element e)
private java.lang.String
populateOptions(org.w3c.dom.Element e, java.util.List<java.lang.String> labels, java.util.List<java.lang.String> values, java.util.List<java.lang.Integer> selectedIndices)
int
process(org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm acro, int startId, Box root)
private void
processCheckboxControl(PdfBoxForm.ControlFontPair pair, org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm acro, int i, PdfBoxForm.Control ctrl, Box root)
private void
processControlNames()
This method will create a tree of names, both non-terminal and terminal.private void
processHiddenControl(PdfBoxForm.ControlFontPair pair, PdfBoxForm.Control ctrl, org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm acro, int i, Box root)
private void
processMultiSelectControl(PdfBoxForm.ControlFontPair pair, PdfBoxForm.Control ctrl, org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm acro, int i, Box root)
private void
processRadioButtonGroup(java.util.List<PdfBoxForm.Control> group, org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm acro, int i, Box root)
private void
processSelectControl(PdfBoxForm.ControlFontPair pair, PdfBoxForm.Control ctrl, org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm acro, int i, Box root)
Processes select controls and the custom openhtmltopdf-combo control.private void
processSubmitControl(org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm acro, int i, PdfBoxForm.Control ctrl, Box root)
private void
processTextControl(PdfBoxForm.ControlFontPair pair, PdfBoxForm.Control ctrl, org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm acro, int i, Box root)
private void
setPartialNameToField(PdfBoxForm.Control ctrl, org.apache.pdfbox.pdmodel.interactive.form.PDField field)
private static void
setPartialNameToField(org.w3c.dom.Element element, PdfBoxForm.Field fObj, org.apache.pdfbox.pdmodel.interactive.form.PDField field)
-
-
-
Field Detail
-
docFormsStateContainer
private final PdfBoxPerDocumentFormState docFormsStateContainer
-
od
private final PdfBoxOutputDevice od
-
element
private final org.w3c.dom.Element element
-
controls
private final java.util.List<PdfBoxForm.ControlFontPair> controls
-
submits
private final java.util.List<PdfBoxForm.Control> submits
-
radioGroups
private final java.util.Map<java.lang.String,java.util.List<PdfBoxForm.Control>> radioGroups
-
allFieldMap
private final java.util.Map<java.lang.String,PdfBoxForm.Field> allFieldMap
-
-
Constructor Detail
-
PdfBoxForm
private PdfBoxForm(org.w3c.dom.Element element, PdfBoxPerDocumentFormState forms, PdfBoxOutputDevice od)
-
-
Method Detail
-
createForm
public static PdfBoxForm createForm(org.w3c.dom.Element e, PdfBoxPerDocumentFormState forms, PdfBoxOutputDevice od)
-
addControl
public void addControl(PdfBoxForm.Control ctrl, java.lang.String fontName)
-
processControlNames
private void processControlNames()
This method will create a tree of names, both non-terminal and terminal.
-
createNonTerminalFields
private void createNonTerminalFields(PdfBoxForm.Field f, org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm form)
This method will create the non terminal fields. It is called recursively to create all non-terminal field descendants. It should be called after all the PDField objects are created.
-
createNonTerminalFields
private void createNonTerminalFields(org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm form)
Calls createNonTerminalFields on all root non-terminal fields. Otherwise, root fields are added to the acro form field collection.
-
getColorOperator
private static java.lang.String getColorOperator(FSColor color)
Get a PDF graphics operator for a specific color.
-
getTextareaText
private java.lang.String getTextareaText(org.w3c.dom.Element e)
-
populateOptions
private java.lang.String populateOptions(org.w3c.dom.Element e, java.util.List<java.lang.String> labels, java.util.List<java.lang.String> values, java.util.List<java.lang.Integer> selectedIndices)
-
processMultiSelectControl
private void processMultiSelectControl(PdfBoxForm.ControlFontPair pair, PdfBoxForm.Control ctrl, org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm acro, int i, Box root) throws java.io.IOException
- Throws:
java.io.IOException
-
processSelectControl
private void processSelectControl(PdfBoxForm.ControlFontPair pair, PdfBoxForm.Control ctrl, org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm acro, int i, Box root) throws java.io.IOException
Processes select controls and the custom openhtmltopdf-combo control.- Throws:
java.io.IOException
-
processHiddenControl
private void processHiddenControl(PdfBoxForm.ControlFontPair pair, PdfBoxForm.Control ctrl, org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm acro, int i, Box root) throws java.io.IOException
- Throws:
java.io.IOException
-
processTextControl
private void processTextControl(PdfBoxForm.ControlFontPair pair, PdfBoxForm.Control ctrl, org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm acro, int i, Box root) throws java.io.IOException
- Throws:
java.io.IOException
-
createCheckboxAppearance
public static org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream createCheckboxAppearance(PdfBoxForm.CheckboxStyle style, org.apache.pdfbox.pdmodel.PDDocument doc, org.apache.pdfbox.pdmodel.PDResources resources)
Creates a checkbox appearance stream. Uses an ordinal of the zapf dingbats font for the check mark.
-
createCheckboxAppearance
public static org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream createCheckboxAppearance(java.lang.String appear, org.apache.pdfbox.pdmodel.PDDocument doc, org.apache.pdfbox.pdmodel.PDResources resources)
-
getCOSStringUTF16Encoded
private org.apache.pdfbox.cos.COSString getCOSStringUTF16Encoded(java.lang.String value)
-
processCheckboxControl
private void processCheckboxControl(PdfBoxForm.ControlFontPair pair, org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm acro, int i, PdfBoxForm.Control ctrl, Box root) throws java.io.IOException
- Throws:
java.io.IOException
-
processRadioButtonGroup
private void processRadioButtonGroup(java.util.List<PdfBoxForm.Control> group, org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm acro, int i, Box root) throws java.io.IOException
- Throws:
java.io.IOException
-
processSubmitControl
private void processSubmitControl(org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm acro, int i, PdfBoxForm.Control ctrl, Box root) throws java.io.IOException
- Throws:
java.io.IOException
-
setPartialNameToField
private void setPartialNameToField(PdfBoxForm.Control ctrl, org.apache.pdfbox.pdmodel.interactive.form.PDField field)
-
setPartialNameToField
private static void setPartialNameToField(org.w3c.dom.Element element, PdfBoxForm.Field fObj, org.apache.pdfbox.pdmodel.interactive.form.PDField field)
-
process
public int process(org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm acro, int startId, Box root) throws java.io.IOException
- Throws:
java.io.IOException
-
-