com.itextpdf.text.pdf
Class PdfCopyFieldsImp
java.lang.Object
com.itextpdf.text.DocWriter
com.itextpdf.text.pdf.PdfWriter
com.itextpdf.text.pdf.PdfCopyFieldsImp
- All Implemented Interfaces:
- DocListener, ElementListener, PdfAnnotations, PdfDocumentActions, PdfEncryptionSettings, PdfPageActions, PdfRunDirection, PdfVersion, PdfViewerPreferences, PdfXConformance, EventListener
- Direct Known Subclasses:
- PdfCopyFormsImp
class PdfCopyFieldsImp
- extends PdfWriter
- Author:
- psoares
| Fields inherited from class com.itextpdf.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.itextpdf.text.DocWriter |
closeStream, document, EQUALS, FORWARD, GT, LT, NEWLINE, open, os, pageSize, pause, QUOTE, SPACE, TAB |
|
Method Summary |
(package private) void |
addDocument(PdfReader reader)
|
(package private) void |
addDocument(PdfReader reader,
List<Integer> pagesToKeep)
|
(package private) void |
addPageOffsetToField(HashMap<String,AcroFields.Item> fd,
int pageOffset)
|
private void |
adjustTabOrder(PdfArray annots,
PdfIndirectReference ind,
PdfNumber nn)
|
protected PdfArray |
branchForm(HashMap<String,Object> level,
PdfIndirectReference parent,
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(ArrayList<Object> list,
AcroFields.Item item)
|
protected PdfDictionary |
getCatalog(PdfIndirectReference rootObj)
|
private static 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(String name,
AcroFields.Item item)
|
(package private) void |
mergeFields()
|
(package private) void |
mergeWithMaster(HashMap<String,AcroFields.Item> 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.itextpdf.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, 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.itextpdf.text.DocWriter |
add, addTabs, flush, getISOBytes, isCloseStream, isPaused, newPage, pause, resetPageCount, resume, setCloseStream, 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 |
iTextTag
private static final PdfName iTextTag
zero
private static final Integer zero
readers
ArrayList<PdfReader> readers
readers2intrefs
HashMap<PdfReader,IntHashtable> readers2intrefs
pages2intrefs
HashMap<PdfReader,IntHashtable> pages2intrefs
visited
HashMap<PdfReader,IntHashtable> visited
fields
ArrayList<AcroFields> fields
file
RandomAccessFileOrArray file
fieldTree
HashMap<String,Object> fieldTree
pageRefs
ArrayList<PdfIndirectReference> pageRefs
pageDics
ArrayList<PdfDictionary> pageDics
resources
PdfDictionary resources
form
PdfDictionary form
closing
boolean closing
nd
Document nd
tabOrder
private HashMap<PdfArray,ArrayList<Integer>> tabOrder
calculationOrder
private ArrayList<String> calculationOrder
calculationOrderRefs
private ArrayList<Object> calculationOrderRefs
hasSignature
private boolean hasSignature
widgetKeys
protected static final HashMap<PdfName,Integer> widgetKeys
fieldKeys
protected static final HashMap<PdfName,Integer> fieldKeys
PdfCopyFieldsImp
PdfCopyFieldsImp(OutputStream os)
throws DocumentException
- Throws:
DocumentException
PdfCopyFieldsImp
PdfCopyFieldsImp(OutputStream os,
char pdfVersion)
throws DocumentException
- Throws:
DocumentException
addDocument
void addDocument(PdfReader reader,
List<Integer> pagesToKeep)
throws DocumentException,
IOException
- Throws:
DocumentException
IOException
addDocument
void addDocument(PdfReader reader)
throws DocumentException,
IOException
- Throws:
DocumentException
IOException
getCOName
private static 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 IOException
- Throws:
IOException
adjustTabOrder
private void adjustTabOrder(PdfArray annots,
PdfIndirectReference ind,
PdfNumber nn)
branchForm
protected PdfArray branchForm(HashMap<String,Object> level,
PdfIndirectReference parent,
String fname)
throws IOException
- Throws:
IOException
createAcroForms
protected void createAcroForms()
throws IOException
- Throws:
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 IOException
- Creates the new PDF by merging the fields and forms.
- Throws:
IOException
addPageOffsetToField
void addPageOffsetToField(HashMap<String,AcroFields.Item> fd,
int pageOffset)
createWidgets
void createWidgets(ArrayList<Object> list,
AcroFields.Item item)
mergeField
void mergeField(String name,
AcroFields.Item item)
mergeWithMaster
void mergeWithMaster(HashMap<String,AcroFields.Item> 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()