Ontimize 5.2072EN

com.ontimize.util.pdf
Class PdfFiller

java.lang.Object
  extended bycom.ontimize.util.pdf.PdfFiller
Direct Known Subclasses:
ExtPDFFiller

public abstract class PdfFiller
extends java.lang.Object

Class that contains static methods to create PDF files filling fields for other PDF used like template. Steps to create a template are:

Text to insert will have characteristics of field where is inserted. Images to insert will be adjusted automatically keeping original aspect relation.

Author:
Imatia Innovation

Nested Class Summary
static class PdfFiller.FieldProp
           
 
Field Summary
static boolean DEBUG
           
 
Constructor Summary
PdfFiller()
           
 
Method Summary
static void fillFields(java.io.InputStream pdfInputStream, java.io.OutputStream pdfOutputStream, java.util.Hashtable params, boolean flatFields)
          Fills PDF fields that parameters included in params.
static void fillFields(java.lang.String pdfFile, java.io.OutputStream pdfOutputStream, java.util.Hashtable params, boolean flatFields)
          Fills PDF fields that parameters included in params.
static void fillFields(java.lang.String pdfFile, java.lang.String pdfFileOut, java.util.Hashtable params, boolean flatFields)
          Fills PDF fields that parameters included in params.
static void fillImageFields(java.io.InputStream pdfInputStream, java.io.OutputStream pdfOutputStream, java.util.Hashtable params, boolean flatFields)
          Inserts images from params like byte[] or BytesBlock in pdfInputStream.
static void fillImageFields(java.lang.String pdfFile, java.io.OutputStream pdfOutputStream, java.util.Hashtable params, boolean flatFields)
          Inserts images from params like byte[] or BytesBlock in FileInputStream created with pdfFile.
static void fillImageFields(java.lang.String pdfFile, java.lang.String pdfFileOut, java.util.Hashtable params, boolean flatFields)
          Inserts images from params like byte[] or BytesBlock in FileInputStream created with pdfFile.
static void fillTable(java.io.OutputStream pdfInputStream, Table table)
          Fills the table with data specified in pdfInputStream.
static void fillTextImageFields(java.io.InputStream pdfInputStream, java.io.OutputStream pdfOutputStream, java.util.Hashtable params, java.util.Vector imagesFields, boolean flatFields)
          Fills the fields in PDF file with: Images contained in imagesFields that are in params.
static void fillTextImageFields(java.lang.String pdfFile, java.io.OutputStream pdfOutputStream, java.util.Hashtable params, java.util.Vector imagesFields, boolean flatFields)
          Fills the fields in PDF file with: Images contained in imagesFields that are in params.
static void fillTextImageFields(java.lang.String pdfFile, java.lang.String pdfFileOut, java.util.Hashtable params, java.util.Vector imagesFields, boolean flatFields)
          Fills the fields in PDF file with: Images contained in imagesFields that are in params.
static java.util.Vector getFieldProps(java.io.InputStream pdfInputStream)
          This function returns a Vector with properties of fields.
static java.util.Vector getFieldProps(java.lang.String pdfFile)
          Gets properties of fields for a input file parameter.
static com.lowagie.text.pdf.BarcodePDF417 getPDF417(java.lang.String text)
          Returns the specific bar code for 417PDF specified in text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG
Constructor Detail

PdfFiller

public PdfFiller()
Method Detail

getFieldProps

public static java.util.Vector getFieldProps(java.io.InputStream pdfInputStream)
                                      throws java.lang.Exception
This function returns a Vector with properties of fields.

Parameters:
pdfInputStream - InputStream that contains PDF
Returns:
the Vector with properties
Throws:
java.lang.Exception - when an Exception occurs

getFieldProps

public static java.util.Vector getFieldProps(java.lang.String pdfFile)
                                      throws java.lang.Exception
Gets properties of fields for a input file parameter.

Parameters:
pdfFile - the name of file
Returns:
vector with properties
Throws:
java.lang.Exception - when an Exception occurs

fillFields

public static void fillFields(java.io.InputStream pdfInputStream,
                              java.io.OutputStream pdfOutputStream,
                              java.util.Hashtable params,
                              boolean flatFields)
                       throws java.lang.Exception
Fills PDF fields that parameters included in params.

Parameters:
pdfInputStream - input document stream
pdfOutputStream - output document stream
params - fields and values to fill
flatFields - condition to delete fields
Throws:
java.lang.Exception - when an Exception occurs

fillFields

public static void fillFields(java.lang.String pdfFile,
                              java.io.OutputStream pdfOutputStream,
                              java.util.Hashtable params,
                              boolean flatFields)
                       throws java.lang.Exception
Fills PDF fields that parameters included in params.

Parameters:
pdfFile - name of input pdf
pdfOutputStream - output document stream
params - fields and values to fill
flatFields - condition to delete fields
Throws:
java.lang.Exception - when an Exception occurs

fillFields

public static void fillFields(java.lang.String pdfFile,
                              java.lang.String pdfFileOut,
                              java.util.Hashtable params,
                              boolean flatFields)
                       throws java.lang.Exception
Fills PDF fields that parameters included in params.

Parameters:
pdfFile - name of input pdf
pdfFileOut - name of output pdf
params - fields and values to fill
flatFields - condition to delete fields
Throws:
java.lang.Exception - when an Exception occurs

fillImageFields

public static void fillImageFields(java.io.InputStream pdfInputStream,
                                   java.io.OutputStream pdfOutputStream,
                                   java.util.Hashtable params,
                                   boolean flatFields)
                            throws java.lang.Exception
Inserts images from params like byte[] or BytesBlock in pdfInputStream. Output is set in pdfOutputStream. Images are inserted in (x,y) coordinates correspondent of original field documents that have the same name that params keys.

Parameters:
pdfInputStream - Input PDF used like template
pdfOutputStream - Output PDF file
params - Images to insert
flatFields - This param indicates whether original PDF fields are kept
Throws:
java.lang.Exception - When Exception occurs

fillImageFields

public static void fillImageFields(java.lang.String pdfFile,
                                   java.io.OutputStream pdfOutputStream,
                                   java.util.Hashtable params,
                                   boolean flatFields)
                            throws java.lang.Exception
Inserts images from params like byte[] or BytesBlock in FileInputStream created with pdfFile. Output is set in pdfOutputStream. Images are inserted in (x,y) coordinates correspondent of original field documents that have the same name that params keys.

Parameters:
pdfFile - name of input PDF used like template
pdfOutputStream - Output PDF
params - Images to insert
flatFields - This param indicates whether original PDF fields are kept
Throws:
java.lang.Exception - When Exception occurs

fillImageFields

public static void fillImageFields(java.lang.String pdfFile,
                                   java.lang.String pdfFileOut,
                                   java.util.Hashtable params,
                                   boolean flatFields)
                            throws java.lang.Exception
Inserts images from params like byte[] or BytesBlock in FileInputStream created with pdfFile. Output is set in FileOutputStream created with pdfFileOut. Images are inserted in (x,y) coordinates correspondent of original field documents that have the same name that params keys.

Parameters:
pdfFile - name of input PDF used like template
pdfFileOut - name of output PDF file
params - Images to insert
flatFields - This param indicates whether original PDF fields are kept
Throws:
java.lang.Exception - When Exception occurs

fillTextImageFields

public static void fillTextImageFields(java.io.InputStream pdfInputStream,
                                       java.io.OutputStream pdfOutputStream,
                                       java.util.Hashtable params,
                                       java.util.Vector imagesFields,
                                       boolean flatFields)
                                throws java.lang.Exception
Fills the fields in PDF file with:

Parameters:
pdfInputStream - Input PDF used like template
pdfOutputStream - Output PDF file
params - Data to insert
imagesFields - The vector with name of image fields
flatFields - This parameter indicates whether original PDF fields are kept
Throws:
java.lang.Exception - When Exception occurs

fillTextImageFields

public static void fillTextImageFields(java.lang.String pdfFile,
                                       java.io.OutputStream pdfOutputStream,
                                       java.util.Hashtable params,
                                       java.util.Vector imagesFields,
                                       boolean flatFields)
                                throws java.lang.Exception
Fills the fields in PDF file with:

Parameters:
pdfFile - PDF file name
pdfOutputStream - Output PDF file
params - Data to insert
imagesFields - The vector with name of image fields
flatFields - This parameter indicates whether original PDF fields are kept
Throws:
java.lang.Exception - When Exception occurs

fillTextImageFields

public static void fillTextImageFields(java.lang.String pdfFile,
                                       java.lang.String pdfFileOut,
                                       java.util.Hashtable params,
                                       java.util.Vector imagesFields,
                                       boolean flatFields)
                                throws java.lang.Exception
Fills the fields in PDF file with:

Parameters:
pdfFile - PDF file name
pdfFileOut - Output PDF file name
params - Data to insert
imagesFields - The vector with name of image fields
flatFields - This parameter indicates whether original PDF fields are kept
Throws:
java.lang.Exception - When Exception occurs

getPDF417

public static com.lowagie.text.pdf.BarcodePDF417 getPDF417(java.lang.String text)
Returns the specific bar code for 417PDF specified in text.

Parameters:
text - the text to set to bar code
Returns:
the bar code wit text set

fillTable

public static void fillTable(java.io.OutputStream pdfInputStream,
                             Table table)
                      throws java.lang.Exception
Fills the table with data specified in pdfInputStream.

Parameters:
pdfInputStream - the input data to fill the table
table - table to fill
Throws:
java.lang.Exception - when Exception occurs

Ontimize