Package com.aowagie.text.pdf
Class PdfCopyFieldsImp
- java.lang.Object
-
- com.aowagie.text.DocWriter
-
- com.aowagie.text.pdf.PdfWriter
-
- com.aowagie.text.pdf.PdfCopyFieldsImp
-
- All Implemented Interfaces:
DocListener
,ElementListener
,PdfAnnotations
,PdfDocumentActions
,PdfEncryptionSettings
,PdfPageActions
,PdfRunDirection
,PdfVersion
,PdfViewerPreferences
,PdfXConformance
,java.util.EventListener
class PdfCopyFieldsImp extends PdfWriter
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.aowagie.text.pdf.PdfWriter
PdfWriter.PdfBody, PdfWriter.PdfTrailer
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.ArrayList
calculationOrder
private java.util.ArrayList
calculationOrderRefs
private boolean
closing
protected static java.util.HashMap
fieldKeys
(package private) java.util.ArrayList
fields
private java.util.HashMap
fieldTree
private RandomAccessFileOrArray
file
private PdfDictionary
form
private boolean
hasSignature
private static PdfName
iTextTag
private Document
nd
private java.util.ArrayList
pageDics
private java.util.ArrayList
pageRefs
private java.util.HashMap
pages2intrefs
private java.util.ArrayList
readers
(package private) java.util.HashMap
readers2intrefs
private PdfDictionary
resources
private java.util.HashMap
tabOrder
private java.util.HashMap
visited
private static java.util.HashMap
widgetKeys
private static java.lang.Integer
zero
-
Fields inherited from class com.aowagie.text.pdf.PdfWriter
ALLOW_ASSEMBLY, ALLOW_COPY, ALLOW_DEGRADED_PRINTING, ALLOW_FILL_IN, ALLOW_MODIFY_ANNOTATIONS, ALLOW_MODIFY_CONTENTS, ALLOW_PRINTING, ALLOW_SCREENREADERS, body, CenterWindow, compressionLevel, crypto, currentPdfReaderInstance, DID_PRINT, DID_SAVE, DirectionL2R, DirectionR2L, DisplayDocTitle, DO_NOT_ENCRYPT_METADATA, DOCUMENT_CLOSE, documentOCG, EMBEDDED_FILES_ONLY, ENCRYPTION_AES_128, ENCRYPTION_MASK, FitWindow, fullCompression, GENERATION_MAX, HideMenubar, HideToolbar, HideWindowUI, newBookmarks, NonFullScreenPageModeUseNone, NonFullScreenPageModeUseOC, NonFullScreenPageModeUseOutlines, NonFullScreenPageModeUseThumbs, OCGLocked, OCGRadioGroup, OCProperties, PageLayoutOneColumn, PageLayoutSinglePage, PageLayoutTwoColumnLeft, PageLayoutTwoColumnRight, PageLayoutTwoPageLeft, PageLayoutTwoPageRight, PageModeFullScreen, PageModeUseAttachments, PageModeUseNone, PageModeUseOC, PageModeUseOutlines, PageModeUseThumbs, 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, PDFA2A, PDFA2B, PDFX1A2001, PDFX32002, PDFXNONE, prevxref, PrintScalingNone, root, RUN_DIRECTION_DEFAULT, RUN_DIRECTION_LTR, RUN_DIRECTION_NO_BIDI, RUN_DIRECTION_RTL, STANDARD_ENCRYPTION_128, STANDARD_ENCRYPTION_40, VERSION_1_2, VERSION_1_3, VERSION_1_4, VERSION_1_5, VERSION_1_6, VERSION_1_7, WILL_PRINT, WILL_SAVE, xmpMetadata
-
-
Constructor Summary
Constructors Modifier Constructor Description private
PdfCopyFieldsImp(java.io.OutputStream os, char pdfVersion, java.util.Calendar globalDate)
(package private)
PdfCopyFieldsImp(java.io.OutputStream os, java.util.Calendar globalDate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addDocument(PdfReader reader)
(package private) void
addDocument(PdfReader reader, java.util.List pagesToKeep)
private void
addPageOffsetToField(java.util.HashMap fd, int pageOffset)
private void
adjustTabOrder(PdfArray annots, PdfIndirectReference ind, PdfNumber nn)
private PdfArray
branchForm(java.util.HashMap level, PdfIndirectReference parent, java.lang.String fname)
void
close()
Signals that theDocument
was closed and that no otherElements
will be added.private void
closeIt()
Creates the new PDF by merging the fields and forms.private void
createAcroForms()
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)
private 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)
private boolean
isPage(PRIndirectReference ref)
Checks if a reference refers to a page object.private boolean
isVisited(PRIndirectReference ref)
Checks if a reference has already been "visited" in the copy process.private void
mergeField(java.lang.String name, AcroFields.Item item)
(package private) void
mergeFields()
(package private) void
mergeWithMaster(java.util.HashMap fd)
void
openDoc()
private void
propagate(PdfObject obj, PdfIndirectReference refo, boolean restricted)
private boolean
setVisited(PRIndirectReference ref)
Sets a reference to "visited" in the copy process.protected void
updateCalculationOrder(PdfReader reader)
-
Methods inherited from class com.aowagie.text.pdf.PdfWriter
add, addAnnotation, addAnnotation, addDeveloperExtension, addDirectImageSimple, addDirectTemplateSimple, addFileAttachment, addFileAttachment, addJavaScript, addLocalDestinations, addSharedObjectsToBody, addSimple, addSimple, addSimpleExtGState, addSimplePattern, addSimplePatternColorspace, addSimpleProperty, addSimpleShading, addSimpleShadingPattern, addToBody, addToBody, addToBody, addToBody, addToBody, addToBody, addViewerPreference, createXmpMetadata, eliminateFontSubset, fillOCProperties, freeReader, getAcroForm, getColorspaceName, getCompressionLevel, getCurrentDocumentSize, getCurrentPage, getCurrentPageNumber, getDefaultColorspace, getDirectContent, getDirectContentUnder, getEncryption, getExtraCatalog, getGroup, getImageReference, getImportedPage, getIndirectReferenceNumber, getInfo, getInstance, getOCProperties, getPageEvent, getPageNumber, getPageSize, getPdfDocument, getPdfIndirectReference, getPdfVersion, getPDFXConformance, getReferenceJBIG2Globals, getRootOutline, getRunDirection, getSpaceCharRatio, getStructureTreeRoot, getTabs, getUserunit, isFullCompression, isPdfX, isRgbTransparencyBlending, isStrictImageSequence, isTagged, isUserProperties, open, propertyExists, registerLayer, releaseTemplate, resetContent, setAdditionalAction, setAtLeastPdfVersion, setCollection, setCompressionLevel, setCropBoxSize, setDuration, setEncryption, setEncryption, setFullCompression, setGroup, setInitialLeading, setOpenAction, setOpenAction, setOutlines, 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.aowagie.text.DocWriter
add, getISOBytes, isCloseStream, isPaused, newPage, resetFooter, resetHeader, resetPageCount, setCloseStream, setFooter, setHeader, setMarginMirroring, setMarginMirroringTopBottom, setMargins, setPageCount, setPageSize
-
-
-
-
Field Detail
-
iTextTag
private static final PdfName iTextTag
-
zero
private static final java.lang.Integer zero
-
readers
private final java.util.ArrayList readers
-
readers2intrefs
java.util.HashMap readers2intrefs
-
pages2intrefs
private final java.util.HashMap pages2intrefs
-
visited
private final java.util.HashMap visited
-
fields
java.util.ArrayList fields
-
file
private RandomAccessFileOrArray file
-
fieldTree
private final java.util.HashMap fieldTree
-
pageRefs
private final java.util.ArrayList pageRefs
-
pageDics
private final java.util.ArrayList pageDics
-
resources
private final PdfDictionary resources
-
form
private PdfDictionary form
-
closing
private boolean closing
-
nd
private final Document nd
-
tabOrder
private java.util.HashMap tabOrder
-
calculationOrder
private final java.util.ArrayList calculationOrder
-
calculationOrderRefs
private java.util.ArrayList calculationOrderRefs
-
hasSignature
private boolean hasSignature
-
widgetKeys
private static final java.util.HashMap widgetKeys
-
fieldKeys
protected static final java.util.HashMap fieldKeys
-
-
Constructor Detail
-
PdfCopyFieldsImp
PdfCopyFieldsImp(java.io.OutputStream os, java.util.Calendar globalDate) throws DocumentException
- Throws:
DocumentException
-
PdfCopyFieldsImp
private PdfCopyFieldsImp(java.io.OutputStream os, char pdfVersion, java.util.Calendar globalDate) 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
private 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
private PdfArray branchForm(java.util.HashMap level, PdfIndirectReference parent, java.lang.String fname) throws java.io.IOException
- Throws:
java.io.IOException
-
createAcroForms
private void createAcroForms() throws java.io.IOException
- Throws:
java.io.IOException
-
close
public void close()
Description copied from class:PdfWriter
Signals that theDocument
was closed and that no otherElements
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 interfaceDocListener
- Overrides:
close
in classPdfWriter
- See Also:
DocWriter.close()
-
closeIt
private void closeIt() throws java.io.IOException
Creates the new PDF by merging the fields and forms.- Throws:
java.io.IOException
-
addPageOffsetToField
private void addPageOffsetToField(java.util.HashMap fd, int pageOffset)
-
createWidgets
private void createWidgets(java.util.ArrayList list, AcroFields.Item item)
-
mergeField
private 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 classPdfWriter
- 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 classPdfWriter
-
getNewReference
private PdfIndirectReference getNewReference(PRIndirectReference ref)
-
getNewObjectNumber
protected int getNewObjectNumber(PdfReader reader, int number, int generation)
- Overrides:
getNewObjectNumber
in classPdfWriter
-
setVisited
private 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
private 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
-
isPage
private 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 classPdfWriter
-
openDoc
public void openDoc()
-
-