Interface PdfAcroFormService
- All Known Implementing Classes:
PdfAcroFormServiceImpl
public interface PdfAcroFormService
-
Method Summary
Modifier and TypeMethodDescriptionvoidfillAcroForm(InputStream is, OutputStream os, Map<String, String> fieldValues) Reads a pdf containing a AcroForm from the given input stream, sets all field values and returns the resulting PDF in the given OutputStream Fields are handled as follows: - if null is passed as value, the field is skipped - if the field is a PDCheckbox, the value is parsed as boolean, pass "true" to check it - if the field is a PDRadiobutton, the value is parsed as int (the index of the option to be selected) - else the string value is set as isvoidThis is a helper function that can be used to find the FullyQualified field names of an AcroForm - logs all fieldnames with some type information - prints the fieldname of all textfields into the field itself This method should probably not be used in production code, but it is very handy when implementing an automatic AcroForm field mapping
-
Method Details
-
fillAcroForm
void fillAcroForm(InputStream is, OutputStream os, Map<String, String> fieldValues) throws IOExceptionReads a pdf containing a AcroForm from the given input stream, sets all field values and returns the resulting PDF in the given OutputStream Fields are handled as follows: - if null is passed as value, the field is skipped - if the field is a PDCheckbox, the value is parsed as boolean, pass "true" to check it - if the field is a PDRadiobutton, the value is parsed as int (the index of the option to be selected) - else the string value is set as is- Parameters:
is- InputStream containing the pdfos- OutputStream where the result is written tofieldValues- a map of all field values to be replaced, use the FullyQualifiedName as key- Throws:
IllegalArgumentException- is thrown when the pdf does not contain a AcroForm or a field was not foundIOException
-
findAcroFieldnames
This is a helper function that can be used to find the FullyQualified field names of an AcroForm - logs all fieldnames with some type information - prints the fieldname of all textfields into the field itself This method should probably not be used in production code, but it is very handy when implementing an automatic AcroForm field mapping- Parameters:
is- InputStream containing the pdfos- OutputStream where the result is written to- Throws:
IllegalArgumentException- is thrown when the pdf does not contain a AcroFormIOException
-