com.lowagie.text.pdf
Class PdfStamperImp

java.lang.Object
  extended bycom.lowagie.text.DocWriter
      extended bycom.lowagie.text.pdf.PdfWriter
          extended bycom.lowagie.text.pdf.PdfStamperImp
All Implemented Interfaces:
DocListener, ElementListener, EventListener

class PdfStamperImp
extends PdfWriter


Nested Class Summary
(package private)  class PdfStamperImp.PageStamp
           
 
Nested classes inherited from class com.lowagie.text.pdf.PdfWriter
PdfWriter.PdfBody, PdfWriter.PdfTrailer
 
Field Summary
protected  AcroFields acroFields
           
(package private)  boolean closed
           
(package private)  RandomAccessFileOrArray file
           
protected  boolean flat
           
(package private)  IntHashtable myXref
           
protected  boolean namedAsNames
           
protected  int[] namePtr
           
protected  List newBookmarks
           
(package private)  HashMap pagesToContent
          Integer(page number) -> PageStamp
protected  HashSet partialFlattening
           
(package private)  PdfReader reader
           
private  boolean rotateContents
          Holds value of property rotateContents.
 
Fields inherited from class com.lowagie.text.pdf.PdfWriter
AllowAssembly, AllowCopy, AllowDegradedPrinting, AllowFillIn, AllowModifyAnnotations, AllowModifyContents, AllowPrinting, AllowScreenReaders, body, CenterWindow, colorNumber, crypto, currentPageNumber, currentPdfReaderInstance, DID_PRINT, DID_SAVE, directContent, directContentUnder, DirectionL2R, DirectionR2L, DOCUMENT_CLOSE, documentColors, documentExtGState, documentFonts, documentPatterns, documentShadingPatterns, documentShadings, documentSpotPatterns, FitWindow, fontNumber, formXObjects, formXObjectsCounter, group, HEADER, HideMenubar, HideToolbar, HideWindowUI, imageDictionary, importedPages, NO_SPACE_CHAR_RATIO, NonFullScreenPageModeUseNone, NonFullScreenPageModeUseOutlines, NonFullScreenPageModeUseThumbs, PAGE_CLOSE, PAGE_OPEN, PageLayoutOneColumn, PageLayoutSinglePage, PageLayoutTwoColumnLeft, PageLayoutTwoColumnRight, PageModeFullScreen, PageModeUseNone, PageModeUseOutlines, PageModeUseThumbs, pageReferences, patternColorspaceCMYK, patternColorspaceGRAY, patternColorspaceRGB, patternNumber, pdf, root, RUN_DIRECTION_DEFAULT, RUN_DIRECTION_LTR, RUN_DIRECTION_NO_BIDI, RUN_DIRECTION_RTL, runDirection, SIGNATURE_APPEND_ONLY, SIGNATURE_EXISTS, SPACE_CHAR_RATIO_DEFAULT, STRENGTH128BITS, STRENGTH40BITS, VERSION_1_2, VERSION_1_3, VERSION_1_4, VERSION_1_5, ViewerPreferencesMask, WILL_PRINT, WILL_SAVE
 
Fields inherited from class com.lowagie.text.DocWriter
closeStream, document, EQUALS, FORWARD, GT, LT, NEWLINE, open, os, pageSize, pause, QUOTE, SPACE, TAB
 
Constructor Summary
(package private) PdfStamperImp(PdfReader reader, OutputStream os, char pdfVersion)
          Creates new PdfStamperImp.
 
Method Summary
 void addAnnotation(PdfAnnotation annot)
          Adds a PdfAnnotation or a PdfFormField to the document.
(package private)  void addAnnotation(PdfAnnotation annot, int page)
           
(package private)  void alterContents()
           
(package private)  void alterResources(PdfStamperImp.PageStamp ps)
           
(package private)  void applyRotation(int pageNumber, ByteBuffer out)
           
(package private)  void close(HashMap moreInfo)
           
(package private)  void deleteOutlines()
           
(package private)  void eliminateAcroformObjects()
           
(package private)  void flatFields()
           
(package private)  AcroFields getAcroFields()
           
protected  int getNewObjectNumber(PdfReader reader, int number, int generation)
           
(package private)  PdfContentByte getOverContent(int pageNum)
           
 PdfIndirectReference getPageReference(int page)
          Gets a reference to a page existing or not.
(package private)  PdfStamperImp.PageStamp getPageStamp(int pageNum)
           
(package private)  RandomAccessFileOrArray getReaderFile(PdfReader reader)
           
(package private)  PdfContentByte getUnderContent(int pageNum)
           
(package private)  boolean isContentWritten()
           
(package private)  boolean isRotateContents()
          Getter for property rotateContents.
private  void outlineTravel(PRIndirectReference outline)
           
(package private)  boolean partialFormFlattening(String name)
           
(package private)  void setFormFlattening(boolean flat)
           
(package private)  void setOutlines()
           
(package private)  void setOutlines(List outlines)
           
(package private)  void setRotateContents(boolean rotateContents)
          Setter for property rotateContents.
(package private)  void sweepKids(PdfObject obj)
           
 
Methods inherited from class com.lowagie.text.pdf.PdfWriter
add, add, add, addCalculationOrder, addDirectImageSimple, addDirectTemplateSimple, addJavaScript, addJavaScript, addJavaScript, addLocalDestinations, addSharedObjectsToBody, addSimple, addSimple, addSimpleExtGState, addSimplePattern, addSimplePatternColorspace, addSimpleShading, addSimpleShadingPattern, addToBody, addToBody, addToBody, close, eliminateFontSubset, fitsPage, fitsPage, fitsPage, fitsPage, freeReader, getAcroForm, getCatalog, getCurrentDocumentSize, getCurrentPage, getCurrentPageNumber, getDirectContent, getDirectContentUnder, getEncryption, getExtraCatalog, getGroup, getImageReference, getImportedPage, getIndirectReferenceNumber, getInfo, getInstance, getInstance, getOs, getPageEvent, getPageNumber, getPdfDocument, getPdfIndirectReference, getRootOutline, getRunDirection, getSpaceCharRatio, getTableBottom, isPaused, isStrictImageSequence, open, reorderPages, resetContent, setAdditionalAction, setCropBoxSize, setDuration, setEncryption, setEncryption, setExtraCatalog, setGroup, setLinearPageMode, setOpenAction, setOpenAction, setPageAction, setPageEmpty, setPageEvent, setPageLabels, setPdfVersion, setRunDirection, setSigFlags, setSpaceCharRatio, setStrictImageSequence, setTransition, setViewerPreferences, size
 
Methods inherited from class com.lowagie.text.DocWriter
add, add, addTabs, clearTextWrap, flush, getISOBytes, hasMarkupAttributes, isCloseStream, newPage, pause, removeWatermark, resetFooter, resetHeader, resetPageCount, resume, setCloseStream, setFooter, setHeader, setMargins, setPageCount, setPageSize, write, write, writeEnd, writeEnd, writeMarkupAttributes, writeStart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

RandomAccessFileOrArray file

reader

PdfReader reader

myXref

IntHashtable myXref

pagesToContent

HashMap pagesToContent
Integer(page number) -> PageStamp


closed

boolean closed

rotateContents

private boolean rotateContents
Holds value of property rotateContents.


acroFields

protected AcroFields acroFields

flat

protected boolean flat

namePtr

protected int[] namePtr

namedAsNames

protected boolean namedAsNames

newBookmarks

protected List newBookmarks

partialFlattening

protected HashSet partialFlattening
Constructor Detail

PdfStamperImp

PdfStamperImp(PdfReader reader,
              OutputStream os,
              char pdfVersion)
        throws DocumentException,
               IOException
Creates new PdfStamperImp.

Parameters:
reader - the read PDF
os - the output destination
pdfVersion - the new pdf version or '\0' to keep the same version as the original document
Throws:
DocumentException - on error
IOException
Method Detail

close

void close(HashMap moreInfo)
     throws DocumentException,
            IOException
Throws:
DocumentException
IOException

applyRotation

void applyRotation(int pageNumber,
                   ByteBuffer out)

alterContents

void alterContents()
             throws IOException
Throws:
IOException

alterResources

void alterResources(PdfStamperImp.PageStamp ps)

getNewObjectNumber

protected int getNewObjectNumber(PdfReader reader,
                                 int number,
                                 int generation)
Overrides:
getNewObjectNumber in class PdfWriter

getReaderFile

RandomAccessFileOrArray getReaderFile(PdfReader reader)
Overrides:
getReaderFile in class PdfWriter

getPageStamp

PdfStamperImp.PageStamp getPageStamp(int pageNum)

getUnderContent

PdfContentByte getUnderContent(int pageNum)

getOverContent

PdfContentByte getOverContent(int pageNum)

isRotateContents

boolean isRotateContents()
Getter for property rotateContents.

Returns:
Value of property rotateContents.

setRotateContents

void setRotateContents(boolean rotateContents)
Setter for property rotateContents.

Parameters:
rotateContents - New value of property rotateContents.

isContentWritten

boolean isContentWritten()

getAcroFields

AcroFields getAcroFields()

setFormFlattening

void setFormFlattening(boolean flat)

partialFormFlattening

boolean partialFormFlattening(String name)

flatFields

void flatFields()

eliminateAcroformObjects

void eliminateAcroformObjects()

sweepKids

void sweepKids(PdfObject obj)

getPageReference

public PdfIndirectReference getPageReference(int page)
Description copied from class: PdfWriter
Gets a reference to a page existing or not. If the page does not exist yet the reference will be created in advance. If on closing the document, a page number greater than the total number of pages was requested, an exception is thrown.

Overrides:
getPageReference in class PdfWriter
Parameters:
page - the page number. The first page is 1
Returns:
the reference to the page

addAnnotation

public void addAnnotation(PdfAnnotation annot)
Description copied from class: PdfWriter
Adds a PdfAnnotation or a PdfFormField to the document. Only the top parent of a PdfFormField needs to be added.

Overrides:
addAnnotation in class PdfWriter
Parameters:
annot - the PdfAnnotation or the PdfFormField to add

addAnnotation

void addAnnotation(PdfAnnotation annot,
                   int page)
Overrides:
addAnnotation in class PdfWriter

outlineTravel

private void outlineTravel(PRIndirectReference outline)

deleteOutlines

void deleteOutlines()

setOutlines

void setOutlines()
           throws IOException
Throws:
IOException

setOutlines

void setOutlines(List outlines)