class PdfStamperImp extends PdfWriter
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
PdfStamperImp.PageStamp |
PdfWriter.PdfBody, PdfWriter.PdfTrailer| Modifier and Type | Field and Description |
|---|---|
protected AcroFields |
acroFields |
protected boolean |
append |
(package private) boolean |
closed |
protected boolean |
fieldsAdded |
protected java.util.HashMap |
fieldTemplates |
(package private) RandomAccessFileOrArray |
file |
protected boolean |
flat |
protected boolean |
flatFreeText |
protected int |
initialXrefSize |
protected IntHashtable |
marked |
(package private) IntHashtable |
myXref |
protected int[] |
namePtr |
protected PdfAction |
openAction |
(package private) java.util.HashMap |
pagesToContent
Integer(page number) -> PageStamp
|
protected java.util.HashSet |
partialFlattening |
(package private) PdfReader |
reader |
(package private) java.util.HashMap |
readers2file |
(package private) java.util.HashMap |
readers2intrefs |
private boolean |
rotateContents
Holds value of property rotateContents.
|
protected int |
sigFlags |
protected boolean |
useVp |
protected PdfViewerPreferencesImp |
viewerPreferences |
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| Constructor and Description |
|---|
PdfStamperImp(PdfReader reader,
java.io.OutputStream os,
char pdfVersion,
boolean append)
Creates new PdfStamperImp.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAnnotation(PdfAnnotation annot)
Use this methods to add a
PdfAnnotation or a PdfFormField
to the document. |
(package private) void |
addAnnotation(PdfAnnotation annot,
int page) |
(package private) void |
addAnnotation(PdfAnnotation annot,
PdfDictionary pageN) |
void |
addComments(FdfReader fdf) |
(package private) void |
addDocumentField(PdfIndirectReference ref) |
(package private) void |
addFieldResources() |
(package private) void |
addFileAttachments() |
private void |
addOrder(PdfLayer parent,
PdfArray arr,
java.util.Map ocgmap)
Recursive method to reconstruct the documentOCGorder variable in the writer.
|
void |
addViewerPreference(PdfName key,
PdfObject value)
Adds a viewer preference
|
(package private) void |
alterContents() |
(package private) void |
alterResources(PdfStamperImp.PageStamp ps) |
(package private) void |
applyRotation(PdfDictionary pageN,
ByteBuffer out) |
(package private) void |
close(java.util.HashMap moreInfo) |
(package private) void |
correctAcroFieldPages(int page) |
(package private) void |
deleteOutlines() |
(package private) void |
eliminateAcroformObjects() |
(package private) void |
expandFields(PdfFormField field,
java.util.ArrayList allAnnots) |
(package private) static void |
findAllObjects(PdfReader reader,
PdfObject obj,
IntHashtable hits) |
(package private) void |
flatFields() |
private void |
flatFreeTextFields() |
(package private) AcroFields |
getAcroFields() |
PdfContentByte |
getDirectContent()
Use this method to get the direct content for this document.
|
PdfContentByte |
getDirectContentUnder()
Use this method to get the direct content under for this document.
|
protected int |
getNewObjectNumber(PdfReader reader,
int number,
int generation) |
(package private) PdfContentByte |
getOverContent(int pageNum) |
PdfIndirectReference |
getPageReference(int page)
Use this method to get a reference to a page existing or not.
|
(package private) PdfStamperImp.PageStamp |
getPageStamp(int pageNum) |
java.util.Map |
getPdfLayers()
Gets the PdfLayer objects in an existing document as a Map
with the names/titles of the layers as keys.
|
(package private) RandomAccessFileOrArray |
getReaderFile(PdfReader reader) |
(package private) PdfContentByte |
getUnderContent(int pageNum) |
(package private) void |
insertPage(int pageNumber,
Rectangle mediabox) |
(package private) boolean |
isAppend()
Getter for property append.
|
(package private) boolean |
isContentWritten() |
(package private) boolean |
isRotateContents()
Getter for property rotateContents.
|
(package private) void |
makePackage(PdfCollection collection)
Adds or replaces the Collection Dictionary in the Catalog.
|
protected void |
markUsed(int num) |
protected void |
markUsed(PdfObject obj) |
private static void |
moveRectangle(PdfDictionary dic2,
PdfReader r,
int pageImported,
PdfName key,
java.lang.String name) |
private void |
outlineTravel(PRIndirectReference outline) |
(package private) boolean |
partialFormFlattening(java.lang.String name) |
protected void |
readOCProperties()
Reads the OCProperties dictionary from the catalog of the existing document
and fills the documentOCG, documentOCGorder and OCGRadioGroup variables in PdfWriter.
|
void |
registerReader(PdfReader reader,
boolean openFile) |
(package private) void |
replacePage(PdfReader r,
int pageImported,
int pageReplaced) |
void |
setAdditionalAction(PdfName actionType,
PdfAction action)
Additional-actions defining the actions to be taken in
response to various trigger events affecting the document
as a whole.
|
void |
setDuration(int seconds)
Always throws an
UnsupportedOperationException. |
(package private) void |
setDuration(int seconds,
int page)
Sets the display duration for the page (for presentations)
|
(package private) void |
setFormFlattening(boolean flat) |
(package private) void |
setFreeTextFlattening(boolean flat) |
(package private) void |
setJavaScript() |
void |
setOpenAction(PdfAction action)
When the document opens this
action will be
invoked. |
void |
setOpenAction(java.lang.String name)
When the document opens it will jump to the destination with
this name.
|
(package private) void |
setOutlines() |
void |
setPageAction(PdfName actionType,
PdfAction action)
Always throws an
UnsupportedOperationException. |
(package private) void |
setPageAction(PdfName actionType,
PdfAction action,
int page)
Sets the open and close page additional action.
|
(package private) void |
setRotateContents(boolean rotateContents)
Setter for property rotateContents.
|
void |
setSigFlags(int f)
Set the signature flags.
|
void |
setThumbnail(Image image)
Use this method to set the thumbnail image for the current page.
|
(package private) void |
setThumbnail(Image image,
int page) |
void |
setTransition(PdfTransition transition)
Always throws an
UnsupportedOperationException. |
(package private) void |
setTransition(PdfTransition transition,
int page)
Sets the transition for the page
|
void |
setViewerPreferences(int preferences)
Sets the viewer preferences.
|
(package private) void |
sweepKids(PdfObject obj) |
void |
unRegisterReader(PdfReader reader) |
add, add, add, addCalculationOrder, addDeveloperExtension, addDirectImageSimple, addDirectImageSimple, addDirectTemplateSimple, addFileAttachment, addFileAttachment, addFileAttachment, addJavaScript, addJavaScript, addJavaScript, addJavaScript, addJavaScript, addJavaScript, addLocalDestinations, addOCGRadioGroup, addSharedObjectsToBody, addSimple, addSimple, addSimpleExtGState, addSimplePattern, addSimplePatternColorspace, addSimpleProperty, addSimpleShading, addSimpleShadingPattern, addToBody, addToBody, addToBody, addToBody, addToBody, addToBody, clearTextWrap, close, createXmpMetadata, eliminateFontSubset, fillOCProperties, fitsPage, fitsPage, freeReader, getAcroForm, getBoxSize, getCatalog, getColorspaceName, getCompressionLevel, getCurrentDocumentSize, getCurrentPage, getCurrentPageNumber, getDefaultColorspace, 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, isPdfX, isRgbTransparencyBlending, isStrictImageSequence, isTagged, isUserProperties, lockLayer, open, propertyExists, registerLayer, releaseTemplate, reorderPages, resetContent, setAtLeastPdfVersion, setBoxSize, setCollection, setCompressionLevel, setCropBoxSize, setDefaultColorspace, setEncryption, setEncryption, setEncryption, setEncryption, setEncryption, setFullCompression, setGroup, setInitialLeading, setLinearPageMode, setOutlines, setOutputIntents, setOutputIntents, setOutputIntents, setPageEmpty, setPageEvent, setPageLabels, setPageXmpMetadata, setPdfVersion, setPdfVersion, setPDFXConformance, setRgbTransparencyBlending, setRunDirection, setSpaceCharRatio, setStrictImageSequence, setTabs, setTagged, setUserProperties, setUserunit, setXmpMetadata, writeOutlinesadd, addTabs, flush, getISOBytes, isCloseStream, isPaused, newPage, pause, resetFooter, resetHeader, resetPageCount, resume, setCloseStream, setFooter, setHeader, setMarginMirroring, setMarginMirroringTopBottom, setMargins, setPageCount, setPageSize, write, write, writeEnd, writeEnd, writeMarkupAttributes, writeStartjava.util.HashMap readers2intrefs
java.util.HashMap readers2file
RandomAccessFileOrArray file
PdfReader reader
IntHashtable myXref
java.util.HashMap pagesToContent
boolean closed
private boolean rotateContents
protected AcroFields acroFields
protected boolean flat
protected boolean flatFreeText
protected int[] namePtr
protected java.util.HashSet partialFlattening
protected boolean useVp
protected PdfViewerPreferencesImp viewerPreferences
protected java.util.HashMap fieldTemplates
protected boolean fieldsAdded
protected int sigFlags
protected boolean append
protected IntHashtable marked
protected int initialXrefSize
protected PdfAction openAction
PdfStamperImp(PdfReader reader, java.io.OutputStream os, char pdfVersion, boolean append) throws DocumentException, java.io.IOException
reader - the read PDFos - the output destinationpdfVersion - the new pdf version or '\0' to keep the same version as the original
documentappend - DocumentException - on errorjava.io.IOExceptionvoid close(java.util.HashMap moreInfo)
throws java.io.IOException
java.io.IOExceptionvoid applyRotation(PdfDictionary pageN, ByteBuffer out)
void alterContents()
throws java.io.IOException
java.io.IOExceptionvoid alterResources(PdfStamperImp.PageStamp ps)
protected int getNewObjectNumber(PdfReader reader, int number, int generation)
getNewObjectNumber in class PdfWriterRandomAccessFileOrArray getReaderFile(PdfReader reader)
getReaderFile in class PdfWriterpublic void registerReader(PdfReader reader, boolean openFile) throws java.io.IOException
reader - openFile - java.io.IOExceptionpublic void unRegisterReader(PdfReader reader)
reader - static void findAllObjects(PdfReader reader, PdfObject obj, IntHashtable hits)
public void addComments(FdfReader fdf) throws java.io.IOException
fdf - java.io.IOExceptionPdfStamperImp.PageStamp getPageStamp(int pageNum)
PdfContentByte getUnderContent(int pageNum)
PdfContentByte getOverContent(int pageNum)
void correctAcroFieldPages(int page)
private static void moveRectangle(PdfDictionary dic2, PdfReader r, int pageImported, PdfName key, java.lang.String name)
void replacePage(PdfReader r, int pageImported, int pageReplaced)
void insertPage(int pageNumber,
Rectangle mediabox)
boolean isRotateContents()
void setRotateContents(boolean rotateContents)
rotateContents - New value of property rotateContents.boolean isContentWritten()
AcroFields getAcroFields()
void setFormFlattening(boolean flat)
void setFreeTextFlattening(boolean flat)
boolean partialFormFlattening(java.lang.String name)
void flatFields()
void eliminateAcroformObjects()
void sweepKids(PdfObject obj)
private void flatFreeTextFields()
public PdfIndirectReference getPageReference(int page)
PdfWritergetPageReference in class PdfWriterpage - the page number. The first page is 1PdfWriter.getPageReference(int)public void addAnnotation(PdfAnnotation annot)
PdfAnnotationsPdfAnnotation or a PdfFormField
to the document. Only the top parent of a PdfFormField
needs to be added.addAnnotation in interface PdfAnnotationsaddAnnotation in class PdfWriterannot - the PdfAnnotation or the PdfFormField to addPdfWriter.addAnnotation(com.lowagie.text.pdf.PdfAnnotation)void addDocumentField(PdfIndirectReference ref)
void addFieldResources()
throws java.io.IOException
java.io.IOExceptionvoid expandFields(PdfFormField field, java.util.ArrayList allAnnots)
void addAnnotation(PdfAnnotation annot, PdfDictionary pageN)
void addAnnotation(PdfAnnotation annot, int page)
addAnnotation in class PdfWriterprivate void outlineTravel(PRIndirectReference outline)
void deleteOutlines()
void setJavaScript()
throws java.io.IOException
java.io.IOExceptionvoid addFileAttachments()
throws java.io.IOException
java.io.IOExceptionvoid makePackage(PdfCollection collection)
collection - the new collection dictionary.void setOutlines()
throws java.io.IOException
java.io.IOExceptionpublic void setViewerPreferences(int preferences)
setViewerPreferences in interface PdfViewerPreferencessetViewerPreferences in class PdfWriterpreferences - the viewer preferencesPdfWriter.setViewerPreferences(int)public void addViewerPreference(PdfName key, PdfObject value)
addViewerPreference in interface PdfViewerPreferencesaddViewerPreference in class PdfWriterkey - a key for a viewer preferencevalue - the value for the viewer preferencePdfViewerPreferences.addViewerPreference(com.lowagie.text.pdf.PdfName, com.lowagie.text.pdf.PdfObject)public void setSigFlags(int f)
setSigFlags in interface PdfAnnotationssetSigFlags in class PdfWriterf - the flags. This flags are ORed with current onesPdfAnnotations.setSigFlags(int)public void setPageAction(PdfName actionType, PdfAction action) throws PdfException
UnsupportedOperationException.setPageAction in interface PdfPageActionssetPageAction in class PdfWriteractionType - ignoreaction - ignorePdfException - ignorePdfStamper.setPageAction(PdfName, PdfAction, int)void setPageAction(PdfName actionType, PdfAction action, int page) throws PdfException
actionType - the action type. It can be PdfWriter.PAGE_OPEN
or PdfWriter.PAGE_CLOSEaction - the action to performpage - the page where the action will be applied. The first page is 1PdfException - if the action type is invalidpublic void setDuration(int seconds)
UnsupportedOperationException.setDuration in interface PdfPageActionssetDuration in class PdfWriterseconds - ignorePdfPageActions.setDuration(int)public void setTransition(PdfTransition transition)
UnsupportedOperationException.setTransition in interface PdfPageActionssetTransition in class PdfWritertransition - ignorePdfPageActions.setTransition(com.lowagie.text.pdf.PdfTransition)void setDuration(int seconds,
int page)
seconds - the number of seconds to display the page. A negative value removes the entrypage - the page where the duration will be applied. The first page is 1void setTransition(PdfTransition transition, int page)
transition - the transition object. A null removes the transitionpage - the page where the transition will be applied. The first page is 1protected void markUsed(PdfObject obj)
protected void markUsed(int num)
boolean isAppend()
public void setAdditionalAction(PdfName actionType, PdfAction action) throws PdfException
DOCUMENT_CLOSE,
WILL_SAVE, DID_SAVE, WILL_PRINT
and DID_PRINT.setAdditionalAction in interface PdfDocumentActionssetAdditionalAction in class PdfWriteractionType - the action typeaction - the action to execute in response to the triggerPdfException - on invalid action typePdfDocumentActions.setAdditionalAction(com.lowagie.text.pdf.PdfName, com.lowagie.text.pdf.PdfAction)public void setOpenAction(PdfAction action)
PdfDocumentActionsaction will be
invoked.setOpenAction in interface PdfDocumentActionssetOpenAction in class PdfWriteraction - the action to be invokedPdfWriter.setOpenAction(com.lowagie.text.pdf.PdfAction)public void setOpenAction(java.lang.String name)
PdfDocumentActionssetOpenAction in interface PdfDocumentActionssetOpenAction in class PdfWritername - the name of the destination to jump toPdfWriter.setOpenAction(java.lang.String)public void setThumbnail(Image image)
PdfWritersetThumbnail in class PdfWriterimage - the imagePdfWriter.setThumbnail(com.lowagie.text.Image)void setThumbnail(Image image, int page) throws PdfException, DocumentException
PdfExceptionDocumentExceptionpublic PdfContentByte getDirectContentUnder()
PdfWritergetDirectContentUnder in class PdfWriterpublic PdfContentByte getDirectContent()
PdfWritergetDirectContent in class PdfWriterprotected void readOCProperties()
private void addOrder(PdfLayer parent, PdfArray arr, java.util.Map ocgmap)
parent - a parent PdfLayer (can be null)arr - an array possibly containing children for the parent PdfLayerocgmap - a HashMap with indirect reference Strings as keys and PdfLayer objects as values.public java.util.Map getPdfLayers()