Package com.lowagie.text.pdf
Class PdfStamperImp
- java.lang.Object
-
- com.lowagie.text.DocWriter
-
- com.lowagie.text.pdf.PdfWriter
-
- com.lowagie.text.pdf.PdfStamperImp
-
- All Implemented Interfaces:
DocListener
,ElementListener
,PdfAnnotations
,PdfDocumentActions
,PdfEncryptionSettings
,PdfPageActions
,PdfRunDirection
,PdfVersion
,PdfViewerPreferences
,PdfXConformance
,java.lang.AutoCloseable
,java.util.EventListener
class PdfStamperImp extends PdfWriter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
PdfStamperImp.PageStamp
-
Nested classes/interfaces inherited from class com.lowagie.text.pdf.PdfWriter
PdfWriter.PdfBody, PdfWriter.PdfTrailer
-
-
Field Summary
Fields Modifier and Type Field Description protected AcroFields
acroFields
protected boolean
append
(package private) boolean
closed
protected boolean
fieldsAdded
protected java.util.Map<PdfTemplate,java.lang.Object>
fieldTemplates
(package private) RandomAccessFileOrArray
file
protected boolean
flat
protected boolean
flatFreeText
private boolean
includeFileID
protected int
initialXrefSize
protected IntHashtable
marked
private java.util.Calendar
modificationDate
(package private) IntHashtable
myXref
protected int[]
namePtr
protected PdfAction
openAction
private PdfObject
overrideFileId
(package private) java.util.HashMap<PdfDictionary,PdfStamperImp.PageStamp>
pagesToContent
Integer(page number) -> PageStampprotected java.util.Set<java.lang.String>
partialFlattening
(package private) PdfReader
reader
(package private) java.util.HashMap<PdfReader,RandomAccessFileOrArray>
readers2file
(package private) java.util.HashMap<PdfReader,IntHashtable>
readers2intrefs
private boolean
rotateContents
Holds value of property rotateContents.protected int
sigFlags
private boolean
updateDocInfo
private boolean
updateMetadata
protected boolean
useVp
protected PdfViewerPreferencesImp
viewerPreferences
-
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, 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_AES_256_V3, ENCRYPTION_MASK, ENCRYPTION_NONE, 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, 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 Summary
Constructors Constructor Description PdfStamperImp(PdfReader reader, java.io.OutputStream os, char pdfVersion, boolean append)
Creates new PdfStamperImp.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAnnotation(PdfAnnotation annot)
Use this methods to add aPdfAnnotation
or aPdfFormField
to the document.void
addAnnotation(PdfAnnotation annot, int page)
(package private) void
addAnnotation(PdfAnnotation annotation, PdfDictionary pageN)
private void
addAnnotationToDocument(PdfAnnotation annot)
Allows to add e.g.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<java.lang.String,PdfLayer> 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.Map<java.lang.String,java.lang.String> moreInfo)
(package private) void
correctAcroFieldPages(int page)
(package private) void
deleteOutlines()
(package private) void
eliminateAcroformObjects()
(package private) void
expandFields(PdfFormField field, java.util.List<PdfAnnotation> annotations)
(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.(package private) PdfDictionary
getInfoDictionary(PdfDictionary oldInfo, PdfDate modificationDate, java.lang.String producer, java.util.Map<java.lang.String,java.lang.String> moreInfo)
java.util.Calendar
getModificationDate()
protected int
getNewObjectNumber(PdfReader reader, int number, int generation)
(package private) PdfContentByte
getOverContent(int pageNum)
PdfObject
getOverrideFileId()
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<java.lang.String,PdfLayer>
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()
boolean
isIncludeFileID()
These methods are used by PdfStamper to override some PDF properties when signing PDF files.(package private) boolean
isRotateContents()
Getter for property rotateContents.boolean
isUpdateDocInfo()
boolean
isUpdateMetadata()
(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)
void
removeEncryption()
Removes the encryption from the document (and also inherently the permissions)(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 anUnsupportedOperationException
.(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)
void
setIncludeFileID(boolean includeFileID)
(package private) void
setJavaScript()
void
setModificationDate(java.util.Calendar modificationDate)
void
setOpenAction(PdfAction action)
When the document opens thisaction
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
setOverrideFileId(PdfObject overrideFileId)
void
setPageAction(PdfName actionType, PdfAction action)
Always throws anUnsupportedOperationException
.(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 anUnsupportedOperationException
.(package private) void
setTransition(PdfTransition transition, int page)
Sets the transition for the pagevoid
setUpdateDocInfo(boolean updateDocInfo)
void
setUpdateMetadata(boolean updateMetadata)
void
setViewerPreferences(int preferences)
Sets the viewer preferences.(package private) void
sweepKids(PdfObject obj)
void
unRegisterReader(PdfReader reader)
-
Methods inherited from class com.lowagie.text.pdf.PdfWriter
add, add, add, 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, 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, isPageEmpty, isPdfA1, isPdfX, isRgbTransparencyBlending, isStrictImageSequence, isTagged, isUserProperties, lockLayer, open, propertyExists, registerLayer, releaseTemplate, reorderPages, resetContent, setAtLeastPdfVersion, setBoxSize, setCollection, setCompressionLevel, setCropBoxSize, setDefaultColorspace, 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, 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
-
-
-
-
Field Detail
-
acroFields
protected AcroFields acroFields
-
flat
protected boolean flat
-
flatFreeText
protected boolean flatFreeText
-
namePtr
protected int[] namePtr
-
partialFlattening
protected java.util.Set<java.lang.String> partialFlattening
-
useVp
protected boolean useVp
-
viewerPreferences
protected PdfViewerPreferencesImp viewerPreferences
-
fieldTemplates
protected java.util.Map<PdfTemplate,java.lang.Object> fieldTemplates
-
fieldsAdded
protected boolean fieldsAdded
-
sigFlags
protected int sigFlags
-
append
protected boolean append
-
marked
protected IntHashtable marked
-
initialXrefSize
protected int initialXrefSize
-
openAction
protected PdfAction openAction
-
readers2intrefs
java.util.HashMap<PdfReader,IntHashtable> readers2intrefs
-
readers2file
java.util.HashMap<PdfReader,RandomAccessFileOrArray> readers2file
-
file
RandomAccessFileOrArray file
-
reader
PdfReader reader
-
myXref
IntHashtable myXref
-
pagesToContent
java.util.HashMap<PdfDictionary,PdfStamperImp.PageStamp> pagesToContent
Integer(page number) -> PageStamp
-
closed
boolean closed
-
rotateContents
private boolean rotateContents
Holds value of property rotateContents.
-
includeFileID
private boolean includeFileID
-
overrideFileId
private PdfObject overrideFileId
-
modificationDate
private java.util.Calendar modificationDate
-
updateMetadata
private boolean updateMetadata
-
updateDocInfo
private boolean updateDocInfo
-
-
Constructor Detail
-
PdfStamperImp
PdfStamperImp(PdfReader reader, java.io.OutputStream os, char pdfVersion, boolean append) throws DocumentException, java.io.IOException
Creates new PdfStamperImp.- Parameters:
reader
- the read PDFos
- the output destinationpdfVersion
- the new pdf version or '\0' to keep the same version as the original documentappend
-- Throws:
DocumentException
- on errorjava.io.IOException
-
-
Method Detail
-
findAllObjects
static void findAllObjects(PdfReader reader, PdfObject obj, IntHashtable hits)
-
moveRectangle
private static void moveRectangle(PdfDictionary dic2, PdfReader r, int pageImported, PdfName key, java.lang.String name)
-
close
void close(java.util.Map<java.lang.String,java.lang.String> moreInfo) throws java.io.IOException
- Throws:
java.io.IOException
-
getInfoDictionary
PdfDictionary getInfoDictionary(PdfDictionary oldInfo, PdfDate modificationDate, java.lang.String producer, java.util.Map<java.lang.String,java.lang.String> moreInfo)
-
applyRotation
void applyRotation(PdfDictionary pageN, ByteBuffer out)
-
alterContents
void alterContents() throws java.io.IOException
- Throws:
java.io.IOException
-
alterResources
void alterResources(PdfStamperImp.PageStamp ps)
-
getNewObjectNumber
protected int getNewObjectNumber(PdfReader reader, int number, int generation)
- Overrides:
getNewObjectNumber
in classPdfWriter
-
getReaderFile
RandomAccessFileOrArray getReaderFile(PdfReader reader)
- Overrides:
getReaderFile
in classPdfWriter
-
removeEncryption
public void removeEncryption() throws DocumentException
Removes the encryption from the document (and also inherently the permissions)- Throws:
DocumentException
-
registerReader
public void registerReader(PdfReader reader, boolean openFile) throws java.io.IOException
- Parameters:
reader
-openFile
-- Throws:
java.io.IOException
-
unRegisterReader
public void unRegisterReader(PdfReader reader)
- Parameters:
reader
-
-
addComments
public void addComments(FdfReader fdf) throws java.io.IOException
- Parameters:
fdf
-- Throws:
java.io.IOException
-
getPageStamp
PdfStamperImp.PageStamp getPageStamp(int pageNum)
-
getUnderContent
PdfContentByte getUnderContent(int pageNum)
-
getOverContent
PdfContentByte getOverContent(int pageNum)
-
correctAcroFieldPages
void correctAcroFieldPages(int page)
-
replacePage
void replacePage(PdfReader r, int pageImported, int pageReplaced)
-
insertPage
void insertPage(int pageNumber, Rectangle mediabox)
-
isRotateContents
boolean isRotateContents()
Getter for property rotateContents.- Returns:
- Value of property rotateContents.
-
setRotateContents
void setRotateContents(boolean rotateContents)
Setter for property rotateContents.- Parameters:
rotateContents
- New value of property rotateContents.
-
isContentWritten
boolean isContentWritten()
-
getAcroFields
AcroFields getAcroFields()
-
setFormFlattening
void setFormFlattening(boolean flat)
-
setFreeTextFlattening
void setFreeTextFlattening(boolean flat)
-
partialFormFlattening
boolean partialFormFlattening(java.lang.String name)
-
flatFields
void flatFields()
-
eliminateAcroformObjects
void eliminateAcroformObjects()
-
sweepKids
void sweepKids(PdfObject obj)
-
flatFreeTextFields
private void flatFreeTextFields()
-
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
- See Also:
PdfWriter.getPageReference(int)
-
addDocumentField
void addDocumentField(PdfIndirectReference ref)
-
addFieldResources
void addFieldResources() throws java.io.IOException
- Throws:
java.io.IOException
-
expandFields
void expandFields(PdfFormField field, java.util.List<PdfAnnotation> annotations)
-
addAnnotation
void addAnnotation(PdfAnnotation annotation, PdfDictionary pageN)
-
addAnnotationToDocument
private void addAnnotationToDocument(PdfAnnotation annot)
Allows to add e.g. a Radiogroup without specifying a page for the data field parent. The parent (data) form field isn't located on a page thus it doesn't make sense to specify one.- Parameters:
annot
- annotation to be added
-
addAnnotation
public void addAnnotation(PdfAnnotation annot, int page)
- Overrides:
addAnnotation
in classPdfWriter
-
addAnnotation
public void addAnnotation(PdfAnnotation annot)
Description copied from interface:PdfAnnotations
Use this methods to add aPdfAnnotation
or aPdfFormField
to the document. Only the top parent of aPdfFormField
needs to be added.- Specified by:
addAnnotation
in interfacePdfAnnotations
- Overrides:
addAnnotation
in classPdfWriter
- Parameters:
annot
- thePdfAnnotation
or thePdfFormField
to add- See Also:
PdfWriter.addAnnotation(com.lowagie.text.pdf.PdfAnnotation)
-
outlineTravel
private void outlineTravel(PRIndirectReference outline)
-
deleteOutlines
void deleteOutlines()
-
setJavaScript
void setJavaScript() throws java.io.IOException
- Throws:
java.io.IOException
-
addFileAttachments
void addFileAttachments() throws java.io.IOException
- Throws:
java.io.IOException
-
makePackage
void makePackage(PdfCollection collection)
Adds or replaces the Collection Dictionary in the Catalog.- Parameters:
collection
- the new collection dictionary.
-
setOutlines
void setOutlines() throws java.io.IOException
- Throws:
java.io.IOException
-
setViewerPreferences
public void setViewerPreferences(int preferences)
Sets the viewer preferences.- Specified by:
setViewerPreferences
in interfacePdfViewerPreferences
- Overrides:
setViewerPreferences
in classPdfWriter
- Parameters:
preferences
- the viewer preferences- See Also:
PdfWriter.setViewerPreferences(int)
-
addViewerPreference
public void addViewerPreference(PdfName key, PdfObject value)
Adds a viewer preference- Specified by:
addViewerPreference
in interfacePdfViewerPreferences
- Overrides:
addViewerPreference
in classPdfWriter
- Parameters:
key
- a key for a viewer preferencevalue
- the value for the viewer preference- See Also:
PdfViewerPreferences.addViewerPreference(com.lowagie.text.pdf.PdfName, com.lowagie.text.pdf.PdfObject)
-
setSigFlags
public void setSigFlags(int f)
Set the signature flags.- Specified by:
setSigFlags
in interfacePdfAnnotations
- Overrides:
setSigFlags
in classPdfWriter
- Parameters:
f
- the flags. This flags are ORed with current ones- See Also:
PdfAnnotations.setSigFlags(int)
-
setPageAction
public void setPageAction(PdfName actionType, PdfAction action) throws PdfException
Always throws anUnsupportedOperationException
.- Specified by:
setPageAction
in interfacePdfPageActions
- Overrides:
setPageAction
in classPdfWriter
- Parameters:
actionType
- ignoreaction
- ignore- Throws:
PdfException
- ignore- See Also:
PdfStamper.setPageAction(PdfName, PdfAction, int)
-
setPageAction
void setPageAction(PdfName actionType, PdfAction action, int page) throws PdfException
Sets the open and close page additional action.- Parameters:
actionType
- the action type. It can bePdfWriter.PAGE_OPEN
orPdfWriter.PAGE_CLOSE
action
- the action to performpage
- the page where the action will be applied. The first page is 1- Throws:
PdfException
- if the action type is invalid
-
setDuration
public void setDuration(int seconds)
Always throws anUnsupportedOperationException
.- Specified by:
setDuration
in interfacePdfPageActions
- Overrides:
setDuration
in classPdfWriter
- Parameters:
seconds
- ignore- See Also:
PdfPageActions.setDuration(int)
-
setTransition
public void setTransition(PdfTransition transition)
Always throws anUnsupportedOperationException
.- Specified by:
setTransition
in interfacePdfPageActions
- Overrides:
setTransition
in classPdfWriter
- Parameters:
transition
- ignore- See Also:
PdfPageActions.setTransition(com.lowagie.text.pdf.PdfTransition)
-
setDuration
void setDuration(int seconds, int page)
Sets the display duration for the page (for presentations)- Parameters:
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 1
-
setTransition
void setTransition(PdfTransition transition, int page)
Sets the transition for the page- Parameters:
transition
- the transition object. Anull
removes the transitionpage
- the page where the transition will be applied. The first page is 1
-
markUsed
protected void markUsed(PdfObject obj)
-
markUsed
protected void markUsed(int num)
-
isAppend
boolean isAppend()
Getter for property append.- Returns:
- Value of property append.
-
setAdditionalAction
public void setAdditionalAction(PdfName actionType, PdfAction action) throws PdfException
Additional-actions defining the actions to be taken in response to various trigger events affecting the document as a whole. The actions types allowed are:DOCUMENT_CLOSE
,WILL_SAVE
,DID_SAVE
,WILL_PRINT
andDID_PRINT
.- Specified by:
setAdditionalAction
in interfacePdfDocumentActions
- Overrides:
setAdditionalAction
in classPdfWriter
- Parameters:
actionType
- the action typeaction
- the action to execute in response to the trigger- Throws:
PdfException
- on invalid action type- See Also:
PdfDocumentActions.setAdditionalAction(com.lowagie.text.pdf.PdfName, com.lowagie.text.pdf.PdfAction)
-
setOpenAction
public void setOpenAction(PdfAction action)
Description copied from interface:PdfDocumentActions
When the document opens thisaction
will be invoked.- Specified by:
setOpenAction
in interfacePdfDocumentActions
- Overrides:
setOpenAction
in classPdfWriter
- Parameters:
action
- the action to be invoked- See Also:
PdfWriter.setOpenAction(com.lowagie.text.pdf.PdfAction)
-
setOpenAction
public void setOpenAction(java.lang.String name)
Description copied from interface:PdfDocumentActions
When the document opens it will jump to the destination with this name.- Specified by:
setOpenAction
in interfacePdfDocumentActions
- Overrides:
setOpenAction
in classPdfWriter
- Parameters:
name
- the name of the destination to jump to- See Also:
PdfWriter.setOpenAction(java.lang.String)
-
setThumbnail
public void setThumbnail(Image image)
Description copied from class:PdfWriter
Use this method to set the thumbnail image for the current page.- Overrides:
setThumbnail
in classPdfWriter
- Parameters:
image
- the image- See Also:
PdfWriter.setThumbnail(com.lowagie.text.Image)
-
setThumbnail
void setThumbnail(Image image, int page) throws DocumentException
- Throws:
DocumentException
-
getDirectContentUnder
public PdfContentByte getDirectContentUnder()
Description copied from class:PdfWriter
Use this method to get the direct content under for this document. There is only one direct content, multiple calls to this method will always retrieve the same object.- Overrides:
getDirectContentUnder
in classPdfWriter
- Returns:
- the direct content
-
getDirectContent
public PdfContentByte getDirectContent()
Description copied from class:PdfWriter
Use this method to get the direct content for this document. There is only one direct content, multiple calls to this method will allways retrieve the same object.- Overrides:
getDirectContent
in classPdfWriter
- Returns:
- the direct content
-
readOCProperties
protected void readOCProperties()
Reads the OCProperties dictionary from the catalog of the existing document and fills the documentOCG, documentOCGorder and OCGRadioGroup variables in PdfWriter. Note that the original OCProperties of the existing document can contain more information.- Since:
- 2.1.2
-
addOrder
private void addOrder(PdfLayer parent, PdfArray arr, java.util.Map<java.lang.String,PdfLayer> ocgmap)
Recursive method to reconstruct the documentOCGorder variable in the writer.- Parameters:
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.- Since:
- 2.1.2
-
getPdfLayers
public java.util.Map<java.lang.String,PdfLayer> getPdfLayers()
Gets the PdfLayer objects in an existing document as a Map with the names/titles of the layers as keys.- Returns:
- a Map with all the PdfLayers in the document (and the name/title of the layer as key)
- Since:
- 2.1.2
-
isIncludeFileID
public boolean isIncludeFileID()
These methods are used by PdfStamper to override some PDF properties when signing PDF files.
-
setIncludeFileID
public void setIncludeFileID(boolean includeFileID)
-
getOverrideFileId
public PdfObject getOverrideFileId()
-
setOverrideFileId
public void setOverrideFileId(PdfObject overrideFileId)
-
getModificationDate
public java.util.Calendar getModificationDate()
-
setModificationDate
public void setModificationDate(java.util.Calendar modificationDate)
-
isUpdateMetadata
public boolean isUpdateMetadata()
-
setUpdateMetadata
public void setUpdateMetadata(boolean updateMetadata)
-
isUpdateDocInfo
public boolean isUpdateDocInfo()
-
setUpdateDocInfo
public void setUpdateDocInfo(boolean updateDocInfo)
-
-