Class PdfAcroFormServiceImpl

java.lang.Object
ch.tocco.nice2.conversion.impl.PdfAcroFormServiceImpl
All Implemented Interfaces:
PdfAcroFormService

@Component public class PdfAcroFormServiceImpl extends Object implements PdfAcroFormService
  • Constructor Summary

    Constructors
    Constructor
    Description
    PdfAcroFormServiceImpl(org.slf4j.Logger log)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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 is
    void
    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

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PdfAcroFormServiceImpl

      public PdfAcroFormServiceImpl(org.slf4j.Logger log)
  • Method Details

    • fillAcroForm

      public void fillAcroForm(InputStream is, OutputStream os, Map<String,String> fieldValues) throws IOException
      Description copied from interface: PdfAcroFormService
      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 is
      Specified by:
      fillAcroForm in interface PdfAcroFormService
      Parameters:
      is - InputStream containing the pdf
      os - OutputStream where the result is written to
      fieldValues - a map of all field values to be replaced, use the FullyQualifiedName as key
      Throws:
      IOException
    • findAcroFieldnames

      public void findAcroFieldnames(InputStream is, OutputStream os) throws IOException
      Description copied from interface: PdfAcroFormService
      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
      Specified by:
      findAcroFieldnames in interface PdfAcroFormService
      Parameters:
      is - InputStream containing the pdf
      os - OutputStream where the result is written to
      Throws:
      IOException