com.crionics.jpdf
Class TemplateModule

java.lang.Object
  extended by PdfModule
      extended by com.crionics.jpdf.AbstractModule
          extended by com.crionics.jpdf.TemplateModule

public final class TemplateModule
extends AbstractModule

This Object is used to access all the Form Fields present in the Current Pdf Document. Signature fields must be accessed through the SignerModule.
The supported Form Fields are: Buttons, RadioButtons, Checkboxes and TextFields.


Field Summary
 
Fields inherited from class com.crionics.jpdf.AbstractModule
MOD_CREATOR, MOD_DESCRIPTION, MOD_ENCRYPTION, MOD_MERGER, MOD_PRINTER, MOD_SECURITY, MOD_SIGNER, MOD_TEMPLATE
 
Method Summary
 boolean containsField(java.lang.String fieldName)
          Search for the existence of a field with the specified name
 void createImage(int pageIndex, AbstractImage image, java.awt.geom.AffineTransform op)
          Draws the given image on page pageIndex.
 void deleteField(java.lang.String fieldName)
          Deletes all references to the field from the document
 java.lang.String extractStrings()
          Extract the strings present in all the pages and provides a raw PDF->ascii convertion mechanisum.
 java.lang.String extractStrings(int pageIndex)
          Extract the strings present in a specific page and provides a raw PDF->ascii convertion mechanisum.
 boolean flattenField(java.lang.String fieldName)
           
 AbstractField getField(java.lang.String fieldName)
          Retrieve a "supported" FormField from the current PDF document by its name
 java.util.List getFieldList()
          Retrieve all the "supported" FormFields from the current PDF document.
 PdfGraphic getGraphic(java.lang.String name)
          Retrieves a Graphical Object via its name from the document.
 java.util.List getGraphicList()
          Retrieves the list of Graphical Objects present in the document.
 Outline getOutline()
          Recovers the Outline present in the current document if presents.
 boolean hasFields()
          Return true if the document contains form fields
 void hidePage(int pageIdx)
          Hides the page in the document.
 void movePage(int srcPageIdx, int dstPageIdx)
          Moves a page from one index to the other
 void movePage(int pageIndexStartRange, int pageIndexLastOfRange, int pageIndexOfInsertion)
          Moves a group of page to a new position in the document
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

containsField

public boolean containsField(java.lang.String fieldName)
                      throws java.io.IOException,
                             PdfException
Search for the existence of a field with the specified name

Parameters:
fieldName - The name of the field to search for.
Returns:
true if there a field exist with the specified name, false otherwise.
Throws:
java.io.IOException - Raised if a problem occured while reading the file.
PdfException - Raised if a problem occured while parsing the file.

createImage

public void createImage(int pageIndex,
                        AbstractImage image,
                        java.awt.geom.AffineTransform op)
                 throws java.io.IOException,
                        PdfException
Draws the given image on page pageIndex. This method is just a jook to call the ImageField object.

Parameters:
pageIndex - the page to draw the graphic on [1, pagemax]
image - the gfx itself
op - the transformation to apply, typically a translation/scaling - use Page.getPageFormat() to get page bunderies
Throws:
java.io.IOException
PdfException

deleteField

public void deleteField(java.lang.String fieldName)
                 throws PdfEntityNotFoundException,
                        PdfException,
                        java.io.IOException
Deletes all references to the field from the document

Parameters:
fieldName - the field name
Throws:
PdfEntityNotFoundException - raised if field not found
PdfException - pdf issue
java.io.IOException - io issue

extractStrings

public java.lang.String extractStrings()
                                throws java.io.IOException,
                                       PdfException
Extract the strings present in all the pages and provides a raw PDF->ascii convertion mechanisum. This is not a reliable ASCII converter as it takes the strings in the way the appear in the PDF stream content.

Returns:
A simple ASCII Representation of the document
Throws:
java.io.IOException - Raised if a problem occured while reading the file.
PdfException - Raised if a problem occured while parsing the file.

extractStrings

public java.lang.String extractStrings(int pageIndex)
                                throws java.io.IOException,
                                       PdfException
Extract the strings present in a specific page and provides a raw PDF->ascii convertion mechanisum. This is not a reliable ASCII converter as it takes the strings in the way the appear in the PDF stream content.

Parameters:
pageIndex - The page index (starting at 1).
Returns:
A simple ASCII Representation of the document
Throws:
java.io.IOException - Raised if a problem occured while reading the file.
PdfException - Raised if a problem occured while parsing the file.

flattenField

public boolean flattenField(java.lang.String fieldName)
                     throws java.io.IOException,
                            PdfException
Parameters:
fieldName -
Returns:
true if the field was actually flattened
Throws:
java.io.IOException
PdfException

getField

public AbstractField getField(java.lang.String fieldName)
                       throws PdfException,
                              java.io.IOException
Retrieve a "supported" FormField from the current PDF document by its name

Parameters:
fieldName - The name of the field.
Returns:
The Field found. If the field is an un-supported one, the value null is returned.
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

getFieldList

public java.util.List getFieldList()
                            throws PdfException,
                                   java.io.IOException
Retrieve all the "supported" FormFields from the current PDF document.

Returns:
A list of AbstractField. (The list may be empty if none of the field present in the PDF document are surported ones).
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

getGraphic

public PdfGraphic getGraphic(java.lang.String name)
                      throws java.io.IOException,
                             PdfException
Retrieves a Graphical Object via its name from the document.

Parameters:
name - the name of the image
Returns:
A Graphic Object representing the bitmap of the specified name.
Throws:
java.io.IOException - Raised if a problem occured while reading the file.
PdfException - Raised if a problem occured while parsing the file.

getGraphicList

public java.util.List getGraphicList()
                              throws java.io.IOException,
                                     PdfException
Retrieves the list of Graphical Objects present in the document.

Returns:
The list of Graphics.
Throws:
java.io.IOException - Raised if a problem occured while reading the file.
PdfException - Raised if a problem occured while parsing the file.

getOutline

public Outline getOutline()
                   throws java.io.IOException,
                          PdfException
Recovers the Outline present in the current document if presents.

Returns:
The existing Outline present in the document, or null if none are present.
Throws:
java.io.IOException - Raised if a problem occured while reading the file.
PdfException - Raised if a problem occured while parsing the file.

hasFields

public boolean hasFields()
                  throws java.io.IOException,
                         PdfException
Return true if the document contains form fields

Returns:
true if the document contains form fields
Throws:
java.io.IOException - Raised if a problem occured while reading the file.
PdfException - Raised if a problem occured while parsing the file.

hidePage

public void hidePage(int pageIdx)
              throws java.io.IOException,
                     PdfException
Hides the page in the document. Remember that jPDF is a dynamic parser. As a consequence if you remove page X from the document, all the pages following X are shifted.

Parameters:
pageIdx - page index starts at index 1
Throws:
java.io.IOException - Raised if a problem occured while reading the file.
PdfException - Raised if a problem occured while parsing the file.

movePage

public void movePage(int srcPageIdx,
                     int dstPageIdx)
              throws java.io.IOException,
                     PdfException
Moves a page from one index to the other

Parameters:
srcPageIdx - source page index starts at index 1
dstPageIdx - destination page index starts at index 1
Throws:
java.io.IOException - Raised if a problem occured while reading the file.
PdfException - Raised if a problem occured while parsing the file.

movePage

public void movePage(int pageIndexStartRange,
                     int pageIndexLastOfRange,
                     int pageIndexOfInsertion)
              throws java.io.IOException,
                     PdfException
Moves a group of page to a new position in the document

Parameters:
pageIndexStartRange - The index of the first page of the group to move (page indexes start at 1 !).
pageIndexLastOfRange - The index of the last page of the group to move (page indexes start at 1 !).
pageIndexOfInsertion - The index in the page list where the group will be moved to (page indexes start at 1 !).
Throws:
java.io.IOException - Raised if a problem occured while reading the file.
PdfException - Raised if a problem occured while parsing the file.


Copyright © 1999-2007 Crionics. All Rights Reserved.