com.etymon.pjx.util
Class PdfRenumberOffset

java.lang.Object
  extended by com.etymon.pjx.util.PdfRenumberOffset
All Implemented Interfaces:
PdfObjectFilter

public class PdfRenumberOffset
extends java.lang.Object
implements PdfObjectFilter

Modifies indirect references within a PDF object, adding a specified offset to each object number in a reference. PdfObjectFilter is used to filter the indirect references. This class is synchronized.


Field Summary
protected  int _offset
          The offset value to add to each object number.
protected  boolean _resetG
          Controls whether generation numbers will be set to 0 during the renumbering process.
 
Constructor Summary
PdfRenumberOffset()
          Constructs a PdfRenumberOffset instance.
 
Method Summary
 PdfObject postFilter(PdfObject obj)
          This method is used by renumber(PdfObject) to filter indirect references and should not be called externally.
 PdfObject preFilter(PdfObject obj)
          This method is used by renumber(PdfObject) to filter indirect references and should not be called externally.
 PdfObject renumber(PdfObject obj)
          Adds an offset to the object number in each PdfReference within the specified object.
 void resetGeneration(boolean reset)
          Controls whether generation numbers will be set to 0 during the renumbering process.
 void setOffset(int offset)
          Sets the offset value to add to each object number during renumbering.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_offset

protected int _offset
The offset value to add to each object number.


_resetG

protected boolean _resetG
Controls whether generation numbers will be set to 0 during the renumbering process. If so, the value is true.

Constructor Detail

PdfRenumberOffset

public PdfRenumberOffset()
Constructs a PdfRenumberOffset instance. By default, generation numbers will not be modified (see resetGeneration(boolean)). The offset value defaults to 0 (see setOffset(int)).

Method Detail

setOffset

public void setOffset(int offset)
Sets the offset value to add to each object number during renumbering.

Parameters:
offset - the offset to use.

resetGeneration

public void resetGeneration(boolean reset)
Controls whether generation numbers will be set to 0 during the renumbering process.

Parameters:
reset - if true, generation numbers will be set to 0; otherwise they are not modified.

renumber

public PdfObject renumber(PdfObject obj)
                   throws PdfFormatException
Adds an offset to the object number in each PdfReference within the specified object. The generation number may optionally be reset to 0 (see resetGeneration(boolean)). The offset is specified with setOffset(int).

Parameters:
obj - the object to renumber.
Returns:
the renumbered object.
Throws:
PdfFormatException

preFilter

public PdfObject preFilter(PdfObject obj)
                    throws PdfFormatException
This method is used by renumber(PdfObject) to filter indirect references and should not be called externally. (It is not synchronized.)

Specified by:
preFilter in interface PdfObjectFilter
Parameters:
obj - the object to filter.
Returns:
the filtered object.
Throws:
PdfFormatException

postFilter

public PdfObject postFilter(PdfObject obj)
                     throws PdfFormatException
This method is used by renumber(PdfObject) to filter indirect references and should not be called externally. (It is not synchronized.)

Specified by:
postFilter in interface PdfObjectFilter
Parameters:
obj - the object to filter.
Returns:
the filtered object.
Throws:
PdfFormatException