public class PdfCopy extends PdfWriter
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
PdfCopy.IndirectReferences
This class holds information about indirect references, since they are
renumbered by iText.
|
protected static class |
PdfCopy.RefKey
A key to allow us to hash indirect references
|
PdfWriter.PdfBody, PdfWriter.PdfTrailer| Modifier and Type | Field and Description |
|---|---|
protected PdfIndirectReference |
acroForm |
protected int |
currentObjectNum |
protected java.util.HashMap |
indirectMap |
protected java.util.HashMap |
indirects |
protected java.util.List |
newBookmarks |
protected java.util.ArrayList |
pageNumbersToRefs |
protected PdfReader |
reader |
protected PdfIndirectReference |
topPageParent |
AllowAssembly, AllowCopy, AllowDegradedPrinting, AllowFillIn, AllowModifyAnnotations, AllowModifyContents, AllowPrinting, AllowScreenReaders, body, CenterWindow, colorNumber, crypto, currentPageNumber, currentPdfReaderInstance, defaultColorspace, DID_PRINT, DID_SAVE, directContent, directContentUnder, DirectionL2R, DirectionR2L, DisplayDocTitle, DOCUMENT_CLOSE, documentColors, documentExtGState, documentFonts, documentOCG, documentOCGorder, documentPatterns, documentProperties, documentShadingPatterns, documentShadings, documentSpotPatterns, FitWindow, fontNumber, formXObjects, formXObjectsCounter, fullCompression, group, HEADER, HideMenubar, HideToolbar, HideWindowUI, imageDictionary, importedPages, NO_SPACE_CHAR_RATIO, NonFullScreenPageModeUseNone, NonFullScreenPageModeUseOC, NonFullScreenPageModeUseOutlines, NonFullScreenPageModeUseThumbs, OCGRadioGroup, OCProperties, PAGE_CLOSE, PAGE_OPEN, PageLayoutOneColumn, PageLayoutSinglePage, PageLayoutTwoColumnLeft, PageLayoutTwoColumnRight, PageLayoutTwoPageLeft, PageLayoutTwoPageRight, PageModeFullScreen, PageModeUseAttachments, PageModeUseNone, PageModeUseOC, PageModeUseOutlines, PageModeUseThumbs, pageReferences, patternColorspaceCMYK, patternColorspaceGRAY, patternColorspaceRGB, patternNumber, pdf, PDFX1A2001, PDFX32002, PDFXKEY_CMYK, PDFXKEY_COLOR, PDFXKEY_FONT, PDFXKEY_GSTATE, PDFXKEY_IMAGE, PDFXKEY_LAYER, PDFXKEY_RGB, 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, STRENGTH128BITS, STRENGTH40BITS, structureTreeRoot, tagged, userunit, VERSION_1_2, VERSION_1_3, VERSION_1_4, VERSION_1_5, VERSION_1_6, ViewerPreferencesMask, WILL_PRINT, WILL_SAVE, xmpMetadata| Constructor and Description |
|---|
PdfCopy(Document document,
java.io.OutputStream os)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
(package private) PdfIndirectReference |
add(PdfImage pdfImage)
Writes a
PdfImage to the outputstream. |
PdfIndirectReference |
add(PdfOutline outline) |
(package private) PdfIndirectReference |
add(PdfPage page,
PdfContents contents)
Adds some
PdfContents to this Writer. |
void |
addAnnotation(PdfAnnotation annot)
Adds a
PdfAnnotation or a PdfFormField
to the document. |
void |
addPage(PdfImportedPage iPage)
Add an imported page to our output
|
void |
close()
Signals that the
Document was closed and that no other
Elements will be added. |
void |
copyAcroForm(PdfReader reader)
Copy the acroform for an input document.
|
protected PdfArray |
copyArray(PdfArray in)
Translate a PRArray to a PdfArray.
|
protected PdfDictionary |
copyDictionary(PdfDictionary in)
Translate a PRDictionary to a PdfDictionary.
|
protected PdfIndirectReference |
copyIndirect(PRIndirectReference in)
Translate a PRIndirectReference to a PdfIndirectReference
In addition, translates the object numbers, and copies the
referenced object to the output file.
|
protected PdfObject |
copyObject(PdfObject in)
Translate a PR-object to a Pdf-object
|
protected PdfStream |
copyStream(PRStream in)
Translate a PRStream to a PdfStream.
|
protected PdfDictionary |
getCatalog(PdfIndirectReference rootObj) |
PdfImportedPage |
getImportedPage(PdfReader reader,
int pageNumber)
Grabs a page from the input document
|
PdfIndirectReference |
getPageReference(int page)
Gets a reference to a page existing or not.
|
void |
open()
Signals that the
Document has been opened and that
Elements can be added. |
protected int |
setFromIPage(PdfImportedPage iPage)
convenience method.
|
protected void |
setFromReader(PdfReader reader)
convenience method.
|
void |
setOutlines(java.util.List outlines)
Sets the bookmarks.
|
add, addAnnotation, addCalculationOrder, addDirectImageSimple, addDirectTemplateSimple, addJavaScript, addJavaScript, addJavaScript, addLocalDestinations, addOCGRadioGroup, addSharedObjectsToBody, addSimple, addSimple, addSimpleExtGState, addSimplePattern, addSimplePatternColorspace, addSimpleProperty, addSimpleShading, addSimpleShadingPattern, addToBody, addToBody, addToBody, addToBody, addToBody, addToBody, breakTableIfDoesntFit, checkPDFXConformance, createXmpMetadata, eliminateFontSubset, fitsPage, fitsPage, fitsPage, fitsPage, freeReader, getAcroForm, getBoxSize, getColorspaceName, getCurrentDocumentSize, getCurrentPage, getCurrentPageNumber, getDefaultColorspace, getDirectContent, getDirectContentUnder, getEncryption, getExtraCatalog, getGroup, getImageReference, getIndirectReferenceNumber, getInfo, getInstance, getInstance, getNewObjectNumber, getOCProperties, getOs, getPageEvent, getPageNumber, getPageSize, getPdfDocument, getPdfIndirectReference, getPdfTable, getPDFXConformance, getReaderFile, getRootOutline, getRunDirection, getSpaceCharRatio, getStructureTreeRoot, getTableBottom, getUserunit, getVerticalPosition, isFullCompression, isPaused, isStrictImageSequence, isTagged, propertyExists, registerLayer, releaseTemplate, reorderPages, resetContent, setAdditionalAction, setBoxSize, setCropBoxSize, setDefaultColorspace, setDuration, setEncryption, setEncryption, setFullCompression, setGroup, setLinearPageMode, setOpenAction, setOpenAction, setOutputIntents, setOutputIntents, setPageAction, setPageEmpty, setPageEvent, setPageLabels, setPdfVersion, setPDFXConformance, setRunDirection, setSigFlags, setSpaceCharRatio, setStrictImageSequence, setTagged, setThumbnail, setTransition, setUserunit, setViewerPreferences, setXmpMetadataadd, add, addTabs, clearTextWrap, flush, getISOBytes, hasMarkupAttributes, isCloseStream, newPage, pause, removeWatermark, resetFooter, resetHeader, resetPageCount, resume, setCloseStream, setFooter, setHeader, setMarginMirroring, setMargins, setPageCount, setPageSize, write, write, writeEnd, writeEnd, writeMarkupAttributes, writeStartprotected java.util.HashMap indirects
protected java.util.HashMap indirectMap
protected int currentObjectNum
protected PdfReader reader
protected PdfIndirectReference acroForm
protected PdfIndirectReference topPageParent
protected java.util.ArrayList pageNumbersToRefs
protected java.util.List newBookmarks
public PdfCopy(Document document, java.io.OutputStream os) throws DocumentException
document - os - outputstreamDocumentExceptionpublic void open()
PdfWriterDocument has been opened and that
Elements can be added.
When this method is called, the PDF-document header is written to the outputstream.
open in interface DocListeneropen in class PdfWriterpublic PdfImportedPage getImportedPage(PdfReader reader, int pageNumber)
getImportedPage in class PdfWriterreader - the reader of the documentpageNumber - which page to getprotected PdfIndirectReference copyIndirect(PRIndirectReference in) throws java.io.IOException, BadPdfFormatException
java.io.IOExceptionBadPdfFormatExceptionprotected PdfDictionary copyDictionary(PdfDictionary in) throws java.io.IOException, BadPdfFormatException
java.io.IOExceptionBadPdfFormatExceptionprotected PdfStream copyStream(PRStream in) throws java.io.IOException, BadPdfFormatException
java.io.IOExceptionBadPdfFormatExceptionprotected PdfArray copyArray(PdfArray in) throws java.io.IOException, BadPdfFormatException
java.io.IOExceptionBadPdfFormatExceptionprotected PdfObject copyObject(PdfObject in) throws java.io.IOException, BadPdfFormatException
java.io.IOExceptionBadPdfFormatExceptionprotected int setFromIPage(PdfImportedPage iPage)
protected void setFromReader(PdfReader reader)
public void addPage(PdfImportedPage iPage) throws java.io.IOException, BadPdfFormatException
iPage - an imported pageIOException, - BadPdfFormatExceptionjava.io.IOExceptionBadPdfFormatExceptionpublic PdfIndirectReference getPageReference(int page)
PdfWritergetPageReference in class PdfWriterpage - the page number. The first page is 1public void copyAcroForm(PdfReader reader) throws java.io.IOException, BadPdfFormatException
reader - The reader of the input file that is being copiedIOException, - BadPdfFormatExceptionjava.io.IOExceptionBadPdfFormatExceptionprotected PdfDictionary getCatalog(PdfIndirectReference rootObj)
getCatalog in class PdfWriterpublic void setOutlines(java.util.List outlines)
SimpleBookmark#.outlines - the bookmarks or null to remove anypublic void close()
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.
close in interface DocListenerclose in class PdfWriterPdfIndirectReference add(PdfImage pdfImage) throws PdfException
PdfWriterPdfImage to the outputstream.add in class PdfWriterpdfImage - the image to be addedPdfIndirectReference to the encapsulated imagePdfException - when a document isn't open yet, or has been closedpublic PdfIndirectReference add(PdfOutline outline)
public void addAnnotation(PdfAnnotation annot)
PdfWriterPdfAnnotation or a PdfFormField
to the document. Only the top parent of a PdfFormField
needs to be added.addAnnotation in class PdfWriterannot - the PdfAnnotation or the PdfFormField to addPdfIndirectReference add(PdfPage page, PdfContents contents) throws PdfException
PdfWriterPdfContents to this Writer.
The document has to be open before you can begin to add content to the body of the document.
add in class PdfWriterpage - the PdfPage to addcontents - the PdfContents of the pagePdfIndirectReferencePdfException - on error