## com.lowagie.text.pdf
Class PdfCopyFieldsImp

    java.lang.Object
      com.lowagie.text.DocWriter
          com.lowagie.text.pdf.PdfWriter
              com.lowagie.text.pdf.PdfCopyFieldsImp

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

Direct Known Subclasses:
  PdfCopyFormsImp

     class PdfCopyFieldsImp

extends PdfWriter

Author:
  psoares

Nested Class Summary

Nested classes/interfaces inherited from class com.lowagie.text.pdf.PdfWriter
`PdfWriter.PdfBody, PdfWriter.PdfTrailer`

Field Summary
`private java.util.ArrayList` `calculationOrder`
`private java.util.ArrayList` `calculationOrderRefs`
`(package private) boolean` `closing`
`protected static java.util.HashMap` `fieldKeys`
`(package private) java.util.ArrayList` `fields`
`(package private) java.util.HashMap` `fieldTree`
`(package private) RandomAccessFileOrArray` `file`
`(package private) PdfDictionary` `form`
`private boolean` `hasSignature`
`private static PdfName` `iTextTag`
`(package private) Document` `nd`
`(package private) java.util.ArrayList` `pageDics`
`(package private) java.util.ArrayList` `pageRefs`
`(package private) java.util.HashMap` `pages2intrefs`
`(package private) java.util.ArrayList` `readers`
`(package private) java.util.HashMap` `readers2intrefs`
`(package private) PdfDictionary` `resources`
`private java.util.HashMap` `tabOrder`
`(package private) java.util.HashMap` `visited`
`protected static java.util.HashMap` `widgetKeys`
`private static java.lang.Integer` `zero`

Fields inherited from class com.lowagie.text.pdf.PdfWriter

`ALLOW_ASSEMBLY, ALLOW_COPY, ALLOW_DEGRADED_PRINTING, ALLOW_FILL_IN, ALLOW_MODIFY_ANNOTATIONS, ALLOW_MODIFY_CONTENTS, ALLOW_PRINTING, ALLOW_SCREENREADERS, AllowAssembly, AllowCopy, AllowDegradedPrinting, AllowFillIn, AllowModifyAnnotations, AllowModifyContents, AllowPrinting, AllowScreenReaders, body, CenterWindow, colorNumber, compressionLevel, crypto, currentPageNumber, currentPdfReaderInstance, defaultColorspace, DID_PRINT, DID_SAVE, directContent, directContentUnder, DirectionL2R, DirectionR2L, DisplayDocTitle, DO_NOT_ENCRYPT_METADATA, DOCUMENT_CLOSE, documentColors, documentExtGState, documentFonts, documentOCG, documentOCGorder, documentPatterns, documentProperties, documentShadingPatterns, documentShadings, documentSpotPatterns, EMBEDDED_FILES_ONLY, ENCRYPTION_AES_128, ENCRYPTION_MASK, extraCatalog, FitWindow, fontNumber, formXObjects, formXObjectsCounter, fullCompression, GENERATION_MAX, group, HideMenubar, HideToolbar, HideWindowUI, imageDictionary, importedPages, JBIG2Globals, newBookmarks, NO_SPACE_CHAR_RATIO, NonFullScreenPageModeUseNone, NonFullScreenPageModeUseOC, NonFullScreenPageModeUseOutlines, NonFullScreenPageModeUseThumbs, OCGLocked, OCGRadioGroup, OCProperties, PAGE_CLOSE, PAGE_OPEN, PageLayoutOneColumn, PageLayoutSinglePage, PageLayoutTwoColumnLeft, PageLayoutTwoColumnRight, PageLayoutTwoPageLeft, PageLayoutTwoPageRight, PageModeFullScreen, PageModeUseAttachments, PageModeUseNone, PageModeUseOC, PageModeUseOutlines, PageModeUseThumbs, pageReferences, patternColorspaceCMYK, patternColorspaceGRAY, patternColorspaceRGB, patternNumber, pdf, pdf_version, PDF_VERSION_1_2, PDF_VERSION_1_3, PDF_VERSION_1_4, PDF_VERSION_1_5, PDF_VERSION_1_6, PDF_VERSION_1_7, PDFA1A, PDFA1B, PDFX1A2001, PDFX32002, PDFXNONE, prevxref, PrintScalingNone, root, RUN_DIRECTION_DEFAULT, RUN_DIRECTION_LTR, RUN_DIRECTION_NO_BIDI, RUN_DIRECTION_RTL, runDirection, SIGNATURE_APPEND_ONLY, SIGNATURE_EXISTS, SPACE_CHAR_RATIO_DEFAULT, STANDARD_ENCRYPTION_128, STANDARD_ENCRYPTION_40, STRENGTH128BITS, STRENGTH40BITS, structureTreeRoot, tabs, tagged, userunit, VERSION_1_2, VERSION_1_3, VERSION_1_4, VERSION_1_5, VERSION_1_6, VERSION_1_7, WILL_PRINT, WILL_SAVE, xmpMetadata`

Fields inherited from class com.lowagie.text.DocWriter
`closeStream, document, EQUALS, FORWARD, GT, LT, NEWLINE, open, os, pageSize, pause, QUOTE, SPACE, TAB`

Constructor Summary
`PdfCopyFieldsImp(java.io.OutputStream os)`
`PdfCopyFieldsImp(java.io.OutputStream os, char pdfVersion)`

Method Summary
`(package private) void` `addDocument(PdfReader reader)`
`(package private) void` `addDocument(PdfReader reader, java.util.List pagesToKeep)`
`(package private) void` `addPageOffsetToField(java.util.HashMap fd, int pageOffset)`
`private void` `adjustTabOrder(PdfArray annots, PdfIndirectReference ind, PdfNumber nn)`
`protected PdfArray` `branchForm(java.util.HashMap level, PdfIndirectReference parent, java.lang.String fname)`
`void` `close()` Signals that the `Document` was closed and that no other `Elements` will be added.
`protected void` `closeIt()` Creates the new PDF by merging the fields and forms.
`protected void` `createAcroForms()`
`(package private) void` `createWidgets(java.util.ArrayList list, AcroFields.Item item)`
`protected PdfDictionary` `getCatalog(PdfIndirectReference rootObj)`
`private static java.lang.String` `getCOName(PdfReader reader, PRIndirectReference ref)`
`protected int` `getNewObjectNumber(PdfReader reader, int number, int generation)`
`protected PdfIndirectReference` `getNewReference(PRIndirectReference ref)`
`PdfIndirectReference` `getPageReference(int page)` Use this method to get a reference to a page existing or not.
`(package private) RandomAccessFileOrArray` `getReaderFile(PdfReader reader)`
`protected boolean` `isPage(PRIndirectReference ref)` Checks if a reference refers to a page object.
`protected boolean` `isVisited(PdfReader reader, int number, int generation)`
`protected boolean` `isVisited(PRIndirectReference ref)` Checks if a reference has already been "visited" in the copy process.
`(package private) void` `mergeField(java.lang.String name, AcroFields.Item item)`
`(package private) void` `mergeFields()`
`(package private) void` `mergeWithMaster(java.util.HashMap fd)`
`void` `openDoc()`
`(package private) void` `propagate(PdfObject obj, PdfIndirectReference refo, boolean restricted)`
`protected boolean` `setVisited(PRIndirectReference ref)` Sets a reference to "visited" in the copy process.
`protected void` `updateCalculationOrder(PdfReader reader)`

Methods inherited from class com.lowagie.text.pdf.PdfWriter

`add, add, add, addAnnotation, addAnnotation, addCalculationOrder, addDeveloperExtension, addDirectImageSimple, addDirectImageSimple, addDirectTemplateSimple, addFileAttachment, addFileAttachment, addFileAttachment, addJavaScript, addJavaScript, addJavaScript, addJavaScript, addJavaScript, addJavaScript, addLocalDestinations, addNamedDestination, addNamedDestinations, addOCGRadioGroup, addSharedObjectsToBody, addSimple, addSimple, addSimpleExtGState, addSimplePattern, addSimplePatternColorspace, addSimpleProperty, addSimpleShading, addSimpleShadingPattern, addToBody, addToBody, addToBody, addToBody, addToBody, addToBody, addViewerPreference, clearTextWrap, createXmpMetadata, eliminateFontSubset, fillOCProperties, fitsPage, fitsPage, freeReader, getAcroForm, getBoxSize, getColorspaceName, getCompressionLevel, getCurrentDocumentSize, getCurrentPage, getCurrentPageNumber, getDefaultColorspace, getDirectContent, getDirectContentUnder, getEncryption, getExtraCatalog, getGroup, getImageReference, getImportedPage, getIndirectReferenceNumber, getInfo, getInstance, getInstance, getOCProperties, getOs, getPageEvent, getPageNumber, getPageSize, getPdfDocument, getPdfIndirectReference, getPdfVersion, getPDFXConformance, getReferenceJBIG2Globals, getRootOutline, getRunDirection, getSpaceCharRatio, getStructureTreeRoot, getTabs, getUserunit, getVerticalPosition, isFullCompression, isPageEmpty, isPdfX, isRgbTransparencyBlending, isStrictImageSequence, isTagged, isUserProperties, lockLayer, open, propertyExists, registerLayer, releaseTemplate, reorderPages, resetContent, setAdditionalAction, setAtLeastPdfVersion, setBoxSize, setCollection, setCompressionLevel, setCropBoxSize, setDefaultColorspace, setDuration, setEncryption, setEncryption, setEncryption, setEncryption, setEncryption, setFullCompression, setGroup, setInitialLeading, setLinearPageMode, setOpenAction, setOpenAction, setOutlines, setOutputIntents, setOutputIntents, setOutputIntents, setPageAction, setPageEmpty, setPageEvent, setPageLabels, setPageXmpMetadata, setPdfVersion, setPdfVersion, setPDFXConformance, setRgbTransparencyBlending, setRunDirection, setSigFlags, setSpaceCharRatio, setStrictImageSequence, setTabs, setTagged, setThumbnail, setTransition, setUserProperties, setUserunit, setViewerPreferences, setXmpMetadata, writeOutlines`

Methods inherited from class com.lowagie.text.DocWriter
`add, addTabs, flush, getISOBytes, isCloseStream, isPaused, newPage, pause, resetFooter, resetHeader, resetPageCount, resume, setCloseStream, setFooter, setHeader, setMarginMirroring, setMarginMirroringTopBottom, 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

### iTextTag

    private static final PdfName iTextTag

### zero

    private static final java.lang.Integer zero

### readers

    java.util.ArrayList readers

### readers2intrefs

    java.util.HashMap readers2intrefs

### pages2intrefs

    java.util.HashMap pages2intrefs

### visited

    java.util.HashMap visited

### fields

    java.util.ArrayList fields

### file

    RandomAccessFileOrArray file

### fieldTree

    java.util.HashMap fieldTree

### pageRefs

    java.util.ArrayList pageRefs

### pageDics

    java.util.ArrayList pageDics

### resources

    PdfDictionary resources

### form

    PdfDictionary form

### closing

    boolean closing

### nd

    Document nd

### tabOrder

    private java.util.HashMap tabOrder

### calculationOrder

    private java.util.ArrayList calculationOrder

### calculationOrderRefs

    private java.util.ArrayList calculationOrderRefs

### hasSignature

    private boolean hasSignature

### widgetKeys

    protected static final java.util.HashMap widgetKeys

### fieldKeys

    protected static final java.util.HashMap fieldKeys

Constructor Detail

### PdfCopyFieldsImp

    PdfCopyFieldsImp(java.io.OutputStream os)
               throws DocumentException

Throws:
  `DocumentException`

### PdfCopyFieldsImp

    PdfCopyFieldsImp(java.io.OutputStream os,
                     char pdfVersion)
               throws DocumentException

Throws:
  `DocumentException`

Method Detail

### addDocument

    void addDocument(PdfReader reader,
                     java.util.List pagesToKeep)
               throws DocumentException,
                      java.io.IOException

  Throws:
    `DocumentException`
    `java.io.IOException`

### addDocument

    void addDocument(PdfReader reader)
               throws DocumentException,
                      java.io.IOException

  Throws:
    `DocumentException`
    `java.io.IOException`

### getCOName

    private static java.lang.String getCOName(PdfReader reader,
                                              PRIndirectReference ref)

### updateCalculationOrder

    protected void updateCalculationOrder(PdfReader reader)

  Since:
    2.1.5; before 2.1.5 the method was private

### propagate

    void propagate(PdfObject obj,
                   PdfIndirectReference refo,
                   boolean restricted)
             throws java.io.IOException

  Throws:
    `java.io.IOException`

### adjustTabOrder

    private void adjustTabOrder(PdfArray annots,
                                PdfIndirectReference ind,
                                PdfNumber nn)

### branchForm

    protected PdfArray branchForm(java.util.HashMap level,
                                  PdfIndirectReference parent,
                                  java.lang.String fname)
                           throws java.io.IOException

  Throws:
    `java.io.IOException`

### createAcroForms

    protected void createAcroForms()
                            throws java.io.IOException

  Throws:
    `java.io.IOException`

### 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 reference table is composed and everything is written to the outputstream embedded in a Trailer.

  Specified by:
    `close` in interface `DocListener`
  Overrides:
    `close` in class `PdfWriter`
  See Also:
    `DocWriter.close()`

### closeIt

    protected void closeIt()
                    throws java.io.IOException

  Creates the new PDF by merging the fields and forms.

  Throws:
    `java.io.IOException`

### addPageOffsetToField

    void addPageOffsetToField(java.util.HashMap fd,
                              int pageOffset)

### createWidgets

    void createWidgets(java.util.ArrayList list,
                       AcroFields.Item item)

### mergeField

    void mergeField(java.lang.String name,
                    AcroFields.Item item)

### mergeWithMaster

    void mergeWithMaster(java.util.HashMap fd)

### mergeFields

    void mergeFields()

### getPageReference

    public PdfIndirectReference getPageReference(int page)

  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

### getCatalog

    protected PdfDictionary getCatalog(PdfIndirectReference rootObj)

  Overrides:
    `getCatalog` in class `PdfWriter`

### getNewReference

    protected PdfIndirectReference getNewReference(PRIndirectReference ref)

### getNewObjectNumber

    protected int getNewObjectNumber(PdfReader reader,
                                     int number,
                                     int generation)

  Overrides:
    `getNewObjectNumber` in class `PdfWriter`

### setVisited

    protected boolean setVisited(PRIndirectReference ref)

  Sets a reference to "visited" in the copy process.

  Parameters:
    `ref` - the reference that needs to be set to "visited"
  Returns:
    true if the reference was set to visited

### isVisited

    protected boolean isVisited(PRIndirectReference ref)

  Checks if a reference has already been "visited" in the copy process.

  Parameters:
    `ref` - the reference that needs to be checked
  Returns:
    true if the reference was already visited

### isVisited

    protected boolean isVisited(PdfReader reader,
                                int number,
                                int generation)

### isPage

    protected boolean isPage(PRIndirectReference ref)

  Checks if a reference refers to a page object.

  Parameters:
    `ref` - the reference that needs to be checked
  Returns:
    true is the reference refers to a page object.

### getReaderFile

    RandomAccessFileOrArray getReaderFile(PdfReader reader)

  Overrides:
    `getReaderFile` in class `PdfWriter`

### openDoc

    public void openDoc()

Hosted by Hostbasket