com.etymon.pjx.util
Class PdfAppender

java.lang.Object
  extended by com.etymon.pjx.util.PdfAppender

public class PdfAppender
extends java.lang.Object

Appends multiple PDF documents together, forming a new PDF document.


Field Summary
protected  PdfManager[] _m
          The array of PDF managers.
protected  boolean _printFileNames
          A flag used to indicate whether file names should be printed during the appending process.
protected  int _renumber_offset
          The current amount to offset (increase) all object numbers by.
protected  boolean _used
          Stores whether the append() method has been used.
protected  PdfWriter _w
          The PDF writer.
 
Constructor Summary
PdfAppender(java.util.List managers, PdfWriter writer)
          The class is initialized to read a list of PDF documents (PdfManager objects) in order and to write the resultant document to a specified PdfWriter.
PdfAppender(PdfManager[] managers, PdfWriter writer)
          Deprecated. Use PdfAppender(List, PdfWriter).
 
Method Summary
 void append()
          Performs the append operation.
static void main(java.lang.String[] args)
          Appends multiple PDF documents together using this class.
protected static PdfObject renumber(PdfObject obj, int offset)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_printFileNames

protected boolean _printFileNames
A flag used to indicate whether file names should be printed during the appending process. This is temporary and will be superceded when logging is implemented.


_m

protected PdfManager[] _m
The array of PDF managers.


_renumber_offset

protected int _renumber_offset
The current amount to offset (increase) all object numbers by. The pdfReaderFilter(PdfObject) method renumbers indirect references by adding this value to their object number.


_used

protected boolean _used
Stores whether the append() method has been used.


_w

protected PdfWriter _w
The PDF writer.

Constructor Detail

PdfAppender

public PdfAppender(PdfManager[] managers,
                   PdfWriter writer)
Deprecated. Use PdfAppender(List, PdfWriter).

The class is initialized to read a list of PDF documents (PdfManager objects) in order and to write the resultant document to a specified PdfWriter. The PdfWriter should be newly created (i.e. it should not have been previously used for anything); and after append() has been called, the PdfWriter should be closed and discarded, and this PdfAppender should be discarded.

Parameters:
managers - the documents to read.
writer - the document to write to.

PdfAppender

public PdfAppender(java.util.List managers,
                   PdfWriter writer)
            throws PdfFormatException
The class is initialized to read a list of PDF documents (PdfManager objects) in order and to write the resultant document to a specified PdfWriter. The PdfWriter should be newly created (i.e. it should not have been previously used for anything); and after append() has been called, the PdfWriter should be closed and discarded, and this PdfAppender should be discarded.

Parameters:
managers - the documents to read. This must be a list of PdfManager objects.
writer - the document to write to.
Throws:
PdfFormatException
Method Detail

renumber

protected static PdfObject renumber(PdfObject obj,
                                    int offset)
                             throws PdfFormatException
Throws:
PdfFormatException

append

public void append()
            throws java.io.IOException,
                   PdfFormatException
Performs the append operation. This method can be called only once per instance of this class.

Throws:
java.io.IOException
PdfFormatException

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException,
                        PdfFormatException
Appends multiple PDF documents together using this class. The documents are specified with a list of file names; the last indicating the output file and the others indicating the input files. The input files are appended in the order they are specified within the list.

Parameters:
args - the list of file names. Note that the last file in this list (args[args.length - 1]) is overwritten with the resultant PDF document.
Throws:
java.io.IOException
PdfFormatException