Class PdfStamperImp

All Implemented Interfaces:
DocListener, ElementListener, PdfAnnotations, PdfDocumentActions, PdfEncryptionSettings, PdfPageActions, PdfRunDirection, PdfVersion, PdfViewerPreferences, PdfXConformance, AutoCloseable, EventListener

@Deprecated class PdfStamperImp extends PdfWriter
Deprecated.
  • Field Details

    • acroFields

      protected AcroFields acroFields
      Deprecated.
    • flat

      protected boolean flat
      Deprecated.
    • flatFreeText

      protected boolean flatFreeText
      Deprecated.
    • namePtr

      protected int[] namePtr
      Deprecated.
    • partialFlattening

      protected Set<String> partialFlattening
      Deprecated.
    • useVp

      protected boolean useVp
      Deprecated.
    • viewerPreferences

      protected PdfViewerPreferencesImp viewerPreferences
      Deprecated.
    • fieldTemplates

      protected Map<PdfTemplate,Object> fieldTemplates
      Deprecated.
    • fieldsAdded

      protected boolean fieldsAdded
      Deprecated.
    • sigFlags

      protected int sigFlags
      Deprecated.
    • append

      protected boolean append
      Deprecated.
    • marked

      protected IntHashtable marked
      Deprecated.
    • initialXrefSize

      protected int initialXrefSize
      Deprecated.
    • openAction

      protected PdfAction openAction
      Deprecated.
    • readers2intrefs

      HashMap<PdfReader,IntHashtable> readers2intrefs
      Deprecated.
    • readers2file

      Deprecated.
    • file

      Deprecated.
    • reader

      PdfReader reader
      Deprecated.
    • myXref

      IntHashtable myXref
      Deprecated.
    • pagesToContent

      Deprecated.
      Integer(page number) -> PageStamp
    • closed

      boolean closed
      Deprecated.
    • rotateContents

      private boolean rotateContents
      Deprecated.
      Holds value of property rotateContents.
    • includeFileID

      private boolean includeFileID
      Deprecated.
    • overrideFileId

      private PdfObject overrideFileId
      Deprecated.
    • modificationDate

      private Calendar modificationDate
      Deprecated.
    • updateMetadata

      private boolean updateMetadata
      Deprecated.
    • updateDocInfo

      private boolean updateDocInfo
      Deprecated.
  • Constructor Details

    • PdfStamperImp

      PdfStamperImp(PdfReader reader, OutputStream os, char pdfVersion, boolean append) throws DocumentException, IOException
      Deprecated.
      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
      append -
      Throws:
      DocumentException - on error
      IOException
  • Method Details

    • findAllObjects

      static void findAllObjects(PdfReader reader, PdfObject obj, IntHashtable hits)
      Deprecated.
    • moveRectangle

      private static void moveRectangle(PdfDictionary dic2, PdfReader r, int pageImported, PdfName key, String name)
      Deprecated.
    • close

      void close(Map<String,String> moreInfo) throws IOException
      Deprecated.
      Throws:
      IOException
    • getInfoDictionary

      PdfDictionary getInfoDictionary(PdfDictionary oldInfo, PdfDate modificationDate, String producer, Map<String,String> moreInfo)
      Deprecated.
    • applyRotation

      void applyRotation(PdfDictionary pageN, ByteBuffer out)
      Deprecated.
    • alterContents

      void alterContents() throws IOException
      Deprecated.
      Throws:
      IOException
    • alterResources

      void alterResources(PdfStamperImp.PageStamp ps)
      Deprecated.
    • getNewObjectNumber

      protected int getNewObjectNumber(PdfReader reader, int number, int generation)
      Deprecated.
      Overrides:
      getNewObjectNumber in class PdfWriter
    • getReaderFile

      RandomAccessFileOrArray getReaderFile(PdfReader reader)
      Deprecated.
      Overrides:
      getReaderFile in class PdfWriter
    • removeEncryption

      public void removeEncryption() throws DocumentException
      Deprecated.
      Removes the encryption from the document (and also inherently the permissions)
      Throws:
      DocumentException
    • registerReader

      public void registerReader(PdfReader reader, boolean openFile) throws IOException
      Deprecated.
      Parameters:
      reader -
      openFile -
      Throws:
      IOException
    • unRegisterReader

      public void unRegisterReader(PdfReader reader)
      Deprecated.
      Parameters:
      reader -
    • addComments

      public void addComments(FdfReader fdf) throws IOException
      Deprecated.
      Parameters:
      fdf -
      Throws:
      IOException
    • getPageStamp

      PdfStamperImp.PageStamp getPageStamp(int pageNum)
      Deprecated.
    • getUnderContent

      PdfContentByte getUnderContent(int pageNum)
      Deprecated.
    • getOverContent

      PdfContentByte getOverContent(int pageNum)
      Deprecated.
    • correctAcroFieldPages

      void correctAcroFieldPages(int page)
      Deprecated.
    • replacePage

      void replacePage(PdfReader r, int pageImported, int pageReplaced)
      Deprecated.
    • insertPage

      void insertPage(int pageNumber, Rectangle mediabox)
      Deprecated.
    • isRotateContents

      boolean isRotateContents()
      Deprecated.
      Getter for property rotateContents.
      Returns:
      Value of property rotateContents.
    • setRotateContents

      void setRotateContents(boolean rotateContents)
      Deprecated.
      Setter for property rotateContents.
      Parameters:
      rotateContents - New value of property rotateContents.
    • isContentWritten

      boolean isContentWritten()
      Deprecated.
    • getAcroFields

      AcroFields getAcroFields()
      Deprecated.
    • setFormFlattening

      void setFormFlattening(boolean flat)
      Deprecated.
    • setFreeTextFlattening

      void setFreeTextFlattening(boolean flat)
      Deprecated.
    • partialFormFlattening

      boolean partialFormFlattening(String name)
      Deprecated.
    • flatFields

      void flatFields()
      Deprecated.
    • eliminateAcroformObjects

      void eliminateAcroformObjects()
      Deprecated.
    • sweepKids

      void sweepKids(PdfObject obj)
      Deprecated.
    • flatFreeTextFields

      private void flatFreeTextFields()
      Deprecated.
    • getPageReference

      public PdfIndirectReference getPageReference(int page)
      Deprecated.
      Description copied from class: PdfWriter
      Use this method to get 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
      See Also:
    • addDocumentField

      void addDocumentField(PdfIndirectReference ref)
      Deprecated.
    • addFieldResources

      void addFieldResources() throws IOException
      Deprecated.
      Throws:
      IOException
    • expandFields

      void expandFields(PdfFormField field, List<PdfAnnotation> annotations)
      Deprecated.
    • addAnnotation

      void addAnnotation(PdfAnnotation annotation, PdfDictionary pageN)
      Deprecated.
    • addAnnotationToDocument

      private void addAnnotationToDocument(PdfAnnotation annot)
      Deprecated.
      Allows to add e.g. a Radiogroup without specifying a page for the data field parent. The parent (data) form field isn't located on a page thus it doesn't make sense to specify one.
      Parameters:
      annot - annotation to be added
    • addAnnotation

      public void addAnnotation(PdfAnnotation annot, int page)
      Deprecated.
      Overrides:
      addAnnotation in class PdfWriter
    • addAnnotation

      public void addAnnotation(PdfAnnotation annot)
      Deprecated.
      Description copied from interface: PdfAnnotations
      Use this methods to add a PdfAnnotation or a PdfFormField to the document. Only the top parent of a PdfFormField needs to be added.
      Specified by:
      addAnnotation in interface PdfAnnotations
      Overrides:
      addAnnotation in class PdfWriter
      Parameters:
      annot - the PdfAnnotation or the PdfFormField to add
      See Also:
    • outlineTravel

      private void outlineTravel(PRIndirectReference outline)
      Deprecated.
    • deleteOutlines

      void deleteOutlines()
      Deprecated.
    • setJavaScript

      void setJavaScript() throws IOException
      Deprecated.
      Throws:
      IOException
    • addFileAttachments

      void addFileAttachments() throws IOException
      Deprecated.
      Throws:
      IOException
    • makePackage

      void makePackage(PdfCollection collection)
      Deprecated.
      Adds or replaces the Collection Dictionary in the Catalog.
      Parameters:
      collection - the new collection dictionary.
    • setOutlines

      void setOutlines() throws IOException
      Deprecated.
      Throws:
      IOException
    • setViewerPreferences

      public void setViewerPreferences(int preferences)
      Deprecated.
      Sets the viewer preferences.
      Specified by:
      setViewerPreferences in interface PdfViewerPreferences
      Overrides:
      setViewerPreferences in class PdfWriter
      Parameters:
      preferences - the viewer preferences
      See Also:
    • addViewerPreference

      public void addViewerPreference(PdfName key, PdfObject value)
      Deprecated.
      Adds a viewer preference
      Specified by:
      addViewerPreference in interface PdfViewerPreferences
      Overrides:
      addViewerPreference in class PdfWriter
      Parameters:
      key - a key for a viewer preference
      value - the value for the viewer preference
      See Also:
    • setSigFlags

      public void setSigFlags(int f)
      Deprecated.
      Set the signature flags.
      Specified by:
      setSigFlags in interface PdfAnnotations
      Overrides:
      setSigFlags in class PdfWriter
      Parameters:
      f - the flags. This flags are ORed with current ones
      See Also:
    • setPageAction

      public void setPageAction(PdfName actionType, PdfAction action) throws PdfException
      Deprecated.
      Always throws an UnsupportedOperationException.
      Specified by:
      setPageAction in interface PdfPageActions
      Overrides:
      setPageAction in class PdfWriter
      Parameters:
      actionType - ignore
      action - ignore
      Throws:
      PdfException - ignore
      See Also:
    • setPageAction

      void setPageAction(PdfName actionType, PdfAction action, int page) throws PdfException
      Deprecated.
      Sets the open and close page additional action.
      Parameters:
      actionType - the action type. It can be PdfWriter.PAGE_OPEN or PdfWriter.PAGE_CLOSE
      action - the action to perform
      page - the page where the action will be applied. The first page is 1
      Throws:
      PdfException - if the action type is invalid
    • setDuration

      public void setDuration(int seconds)
      Deprecated.
      Always throws an UnsupportedOperationException.
      Specified by:
      setDuration in interface PdfPageActions
      Overrides:
      setDuration in class PdfWriter
      Parameters:
      seconds - ignore
      See Also:
    • setTransition

      public void setTransition(PdfTransition transition)
      Deprecated.
      Always throws an UnsupportedOperationException.
      Specified by:
      setTransition in interface PdfPageActions
      Overrides:
      setTransition in class PdfWriter
      Parameters:
      transition - ignore
      See Also:
    • setDuration

      void setDuration(int seconds, int page)
      Deprecated.
      Sets the display duration for the page (for presentations)
      Parameters:
      seconds - the number of seconds to display the page. A negative value removes the entry
      page - the page where the duration will be applied. The first page is 1
    • setTransition

      void setTransition(PdfTransition transition, int page)
      Deprecated.
      Sets the transition for the page
      Parameters:
      transition - the transition object. A null removes the transition
      page - the page where the transition will be applied. The first page is 1
    • markUsed

      protected void markUsed(PdfObject obj)
      Deprecated.
    • markUsed

      protected void markUsed(int num)
      Deprecated.
    • isAppend

      boolean isAppend()
      Deprecated.
      Getter for property append.
      Returns:
      Value of property append.
    • setAdditionalAction

      public void setAdditionalAction(PdfName actionType, PdfAction action) throws PdfException
      Deprecated.
      Additional-actions defining the actions to be taken in response to various trigger events affecting the document as a whole. The actions types allowed are: DOCUMENT_CLOSE, WILL_SAVE, DID_SAVE, WILL_PRINT and DID_PRINT.
      Specified by:
      setAdditionalAction in interface PdfDocumentActions
      Overrides:
      setAdditionalAction in class PdfWriter
      Parameters:
      actionType - the action type
      action - the action to execute in response to the trigger
      Throws:
      PdfException - on invalid action type
      See Also:
    • setOpenAction

      public void setOpenAction(PdfAction action)
      Deprecated.
      Description copied from interface: PdfDocumentActions
      When the document opens this action will be invoked.
      Specified by:
      setOpenAction in interface PdfDocumentActions
      Overrides:
      setOpenAction in class PdfWriter
      Parameters:
      action - the action to be invoked
      See Also:
    • setOpenAction

      public void setOpenAction(String name)
      Deprecated.
      Description copied from interface: PdfDocumentActions
      When the document opens it will jump to the destination with this name.
      Specified by:
      setOpenAction in interface PdfDocumentActions
      Overrides:
      setOpenAction in class PdfWriter
      Parameters:
      name - the name of the destination to jump to
      See Also:
    • setThumbnail

      public void setThumbnail(Image image)
      Deprecated.
      Description copied from class: PdfWriter
      Use this method to set the thumbnail image for the current page.
      Overrides:
      setThumbnail in class PdfWriter
      Parameters:
      image - the image
      See Also:
    • setThumbnail

      void setThumbnail(Image image, int page) throws DocumentException
      Deprecated.
      Throws:
      DocumentException
    • getDirectContentUnder

      public PdfContentByte getDirectContentUnder()
      Deprecated.
      Description copied from class: PdfWriter
      Use this method to get the direct content under for this document. There is only one direct content, multiple calls to this method will always retrieve the same object.
      Overrides:
      getDirectContentUnder in class PdfWriter
      Returns:
      the direct content
    • getDirectContent

      public PdfContentByte getDirectContent()
      Deprecated.
      Description copied from class: PdfWriter
      Use this method to get the direct content for this document. There is only one direct content, multiple calls to this method will allways retrieve the same object.
      Overrides:
      getDirectContent in class PdfWriter
      Returns:
      the direct content
    • readOCProperties

      protected void readOCProperties()
      Deprecated.
      Reads the OCProperties dictionary from the catalog of the existing document and fills the documentOCG, documentOCGorder and OCGRadioGroup variables in PdfWriter. Note that the original OCProperties of the existing document can contain more information.
      Since:
      2.1.2
    • addOrder

      private void addOrder(PdfLayer parent, PdfArray arr, Map<String,PdfLayer> ocgmap)
      Deprecated.
      Recursive method to reconstruct the documentOCGorder variable in the writer.
      Parameters:
      parent - a parent PdfLayer (can be null)
      arr - an array possibly containing children for the parent PdfLayer
      ocgmap - a HashMap with indirect reference Strings as keys and PdfLayer objects as values.
      Since:
      2.1.2
    • getPdfLayers

      public Map<String,PdfLayer> getPdfLayers()
      Deprecated.
      Gets the PdfLayer objects in an existing document as a Map with the names/titles of the layers as keys.
      Returns:
      a Map with all the PdfLayers in the document (and the name/title of the layer as key)
      Since:
      2.1.2
    • isIncludeFileID

      public boolean isIncludeFileID()
      Deprecated.
      These methods are used by PdfStamper to override some PDF properties when signing PDF files.
    • setIncludeFileID

      public void setIncludeFileID(boolean includeFileID)
      Deprecated.
    • getOverrideFileId

      public PdfObject getOverrideFileId()
      Deprecated.
    • setOverrideFileId

      public void setOverrideFileId(PdfObject overrideFileId)
      Deprecated.
    • getModificationDate

      public Calendar getModificationDate()
      Deprecated.
    • setModificationDate

      public void setModificationDate(Calendar modificationDate)
      Deprecated.
    • isUpdateMetadata

      public boolean isUpdateMetadata()
      Deprecated.
    • setUpdateMetadata

      public void setUpdateMetadata(boolean updateMetadata)
      Deprecated.
    • isUpdateDocInfo

      public boolean isUpdateDocInfo()
      Deprecated.
    • setUpdateDocInfo

      public void setUpdateDocInfo(boolean updateDocInfo)
      Deprecated.