Class PdfStamperImp

    • Field Detail

      • readers2intrefs

        java.util.HashMap readers2intrefs
      • readers2file

        java.util.HashMap readers2file
      • pagesToContent

        java.util.HashMap pagesToContent
        Integer(page number) -> PageStamp
      • closed

        boolean closed
      • rotateContents

        private boolean rotateContents
        Holds value of property rotateContents.
      • flat

        protected boolean flat
      • flatFreeText

        protected boolean flatFreeText
      • namePtr

        protected int[] namePtr
      • namedAsNames

        protected boolean namedAsNames
      • newBookmarks

        protected java.util.List newBookmarks
      • partialFlattening

        protected java.util.HashSet partialFlattening
      • useVp

        protected boolean useVp
      • vp

        protected int vp
      • fieldTemplates

        protected java.util.HashMap fieldTemplates
      • fieldsAdded

        protected boolean fieldsAdded
      • sigFlags

        protected int sigFlags
      • append

        protected boolean append
      • initialXrefSize

        protected int initialXrefSize
    • Constructor Detail

      • PdfStamperImp

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

      • close

        public void close()
        Description copied from class: PdfWriter
        Signals that the Document was closed and that no other Elements will be added.

        The pages-tree is built and written to the outputstream. A Catalog is constructed, as well as an Info-object, the referencetable is composed and everything is written to the outputstream embedded in a Trailer.

        Specified by:
        close in interface DocListener
        Overrides:
        close in class PdfWriter
      • alterContents

        void alterContents()
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • registerReader

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

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

        public void addComments​(FdfReader fdf)
                         throws java.io.IOException
        Parameters:
        fdf -
        Throws:
        java.io.IOException
      • getUnderContent

        public PdfContentByte getUnderContent​(int pageNum)
      • getOverContent

        public PdfContentByte getOverContent​(int pageNum)
      • correctAcroFieldPages

        void correctAcroFieldPages​(int page)
      • insertPage

        void insertPage​(int pageNumber,
                        Rectangle mediabox)
      • 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

        public AcroFields getAcroFields()
      • setFormFlattening

        public void setFormFlattening​(boolean flat)
      • setFreeTextFlattening

        void setFreeTextFlattening​(boolean flat)
      • partialFormFlattening

        boolean partialFormFlattening​(java.lang.String name)
      • flatFields

        void flatFields()
      • eliminateAcroformObjects

        void eliminateAcroformObjects()
      • sweepKids

        void sweepKids​(PdfObject obj)
      • flatFreeTextFields

        private void flatFreeTextFields()
      • 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
        See Also:
        PdfWriter.getPageReference(int)
      • addFieldResources

        void addFieldResources()
      • expandFields

        void expandFields​(PdfFormField field,
                          java.util.ArrayList allAnnots)
      • deleteOutlines

        void deleteOutlines()
      • setJavaScript

        void setJavaScript()
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • setOutlines

        void setOutlines()
                  throws java.io.IOException
        Throws:
        java.io.IOException
      • setOutlines

        void setOutlines​(java.util.List outlines)
      • setSigFlags

        public void setSigFlags​(int f)
        Set the signature flags.
        Overrides:
        setSigFlags in class PdfWriter
        Parameters:
        f - the flags. This flags are ORed with current ones
      • setPageAction

        void setPageAction​(PdfName actionType,
                           PdfAction action,
                           int page)
                    throws PdfException
        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)
        Always throws an UnsupportedOperationException.
        Overrides:
        setDuration in class PdfWriter
        Parameters:
        seconds - ignore
      • setTransition

        public void setTransition​(PdfTransition transition)
        Always throws an UnsupportedOperationException.
        Overrides:
        setTransition in class PdfWriter
        Parameters:
        transition - ignore
      • setDuration

        void setDuration​(int seconds,
                         int page)
        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)
        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)
      • markUsed

        protected void markUsed​(int num)
      • isAppend

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

        public void setAdditionalAction​(PdfName actionType,
                                        PdfAction action)
                                 throws PdfException
        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.
        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