Package com.itextpdf.text.pdf
Class PdfStamperImp
- java.lang.Object
-
- com.itextpdf.text.DocWriter
-
- com.itextpdf.text.pdf.PdfWriter
-
- com.itextpdf.text.pdf.PdfStamperImp
-
- All Implemented Interfaces:
DocListener,ElementListener,PdfAnnotations,PdfDocumentActions,PdfEncryptionSettings,PdfPageActions,PdfRunDirection,PdfVersion,PdfViewerPreferences,java.util.EventListener
- Direct Known Subclasses:
PdfAStamperImp
class PdfStamperImp extends PdfWriter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classPdfStamperImp.PageStamp-
Nested classes/interfaces inherited from class com.itextpdf.text.pdf.PdfWriter
PdfWriter.PdfBody, PdfWriter.PdfTrailer
-
-
Field Summary
Fields Modifier and Type Field Description protected AcroFieldsacroFieldsprotected booleanappendprivate java.util.HashMap<java.lang.String,PdfIndirectReference>builtInAnnotationFontsprotected booleanclosedprotected CounterCOUNTERprivate double[]DEFAULT_MATRIXprotected booleanfieldsAddedprotected java.util.HashSet<PdfTemplate>fieldTemplatesprotected RandomAccessFileOrArrayfileprotected booleanflatprotected booleanflatannotationsprotected booleanflatFreeTextprivate static java.util.HashMap<java.lang.String,java.lang.String>fromShortToFullAnnotationFontNamesprotected intinitialXrefSizeprivate Loggerloggerprotected IntHashtablemarked(package private) IntHashtablemyXrefprotected java.util.HashMap<java.lang.Object,PdfObject>namedDestinationsprotected int[]namePtrprotected PdfActionopenActionprivate booleanoriginalLayersAreRead(package private) java.util.HashMap<PdfDictionary,PdfStamperImp.PageStamp>pagesToContentInteger(page number) -> PageStampprotected java.util.HashSet<java.lang.String>partialFlattening(package private) PdfReaderreader(package private) java.util.HashMap<PdfReader,RandomAccessFileOrArray>readers2file(package private) java.util.HashMap<PdfReader,IntHashtable>readers2intrefsprivate booleanrotateContentsHolds value of property rotateContents.protected intsigFlagsprotected booleanuseVpprotected PdfViewerPreferencesImpviewerPreferences-
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, colorProfile, 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, ENCRYPTION_MASK, extraCatalog, FitWindow, fontNumber, formXObjects, formXObjectsCounter, fullCompression, GENERATION_MAX, group, HideMenubar, HideToolbar, HideWindowUI, imageDictionary, JBIG2Globals, markAll, markInlineElementsOnly, newBookmarks, NO_SPACE_CHAR_RATIO, NonFullScreenPageModeUseNone, NonFullScreenPageModeUseOC, NonFullScreenPageModeUseOutlines, NonFullScreenPageModeUseThumbs, OCGLocked, OCGRadioGroup, OCProperties, originalFileID, PAGE_CLOSE, PAGE_OPEN, pageDictEntries, 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, pdfIsoConformance, PDFX1A2001, PDFX32002, PDFXNONE, prevxref, PrintScalingNone, readerInstances, 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, taggingMode, ttfUnicodeWriter, VERSION_1_2, VERSION_1_3, VERSION_1_4, VERSION_1_5, VERSION_1_6, VERSION_1_7, WILL_PRINT, WILL_SAVE, xmpMetadata, xmpWriter
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPdfStamperImp(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 voidaddAnnotation(PdfAnnotation annot)Use this methods to add aPdfAnnotationor aPdfFormFieldto the document.(package private) voidaddAnnotation(PdfAnnotation annot, int page)(package private) voidaddAnnotation(PdfAnnotation annot, PdfDictionary pageN)voidaddComments(FdfReader fdf)(package private) voidaddDocumentField(PdfIndirectReference ref)protected voidaddFieldResources()protected voidaddFileAttachments()private voidaddOrder(PdfLayer parent, PdfArray arr, java.util.Map<java.lang.String,PdfLayer> ocgmap)Recursive method to reconstruct the documentOCGorder variable in the writer.voidaddViewerPreference(PdfName key, PdfObject value)Adds a viewer preferenceprotected voidalterContents()(package private) voidalterResources(PdfStamperImp.PageStamp ps)(package private) voidapplyRotation(PdfDictionary pageN, ByteBuffer out)private AffineTransformcalculateTemplateTransformationMatrix(AffineTransform currentMatrix, double fieldRotation, Rectangle box)protected voidclose(PdfIndirectReference info, int skipInfo)protected voidclose(java.util.Map<java.lang.String,java.lang.String> moreInfo)(package private) voidcorrectAcroFieldPages(int page)voidcreateXmpMetadata()Use this method to creates XMP Metadata based on the metadata in the PdfDocument.(package private) voiddeleteOutlines()(package private) voideliminateAcroformObjects()(package private) voidexpandFields(PdfFormField field, java.util.ArrayList<PdfAnnotation> allAnnots)(package private) static voidfindAllObjects(PdfReader reader, PdfObject obj, IntHashtable hits)protected voidflatFields()protected voidflatFreeTextFields()protected voidflattenAnnotations()If setFlatAnnotations is set to true, iText will flatten all annotations with an appearance streamprivate voidflattenAnnotations(boolean flattenFreeTextAnnotations)(package private) AcroFieldsgetAcroFields()protected CountergetCounter()PdfContentBytegetDirectContent()Use this method to get the direct content for this document.PdfContentBytegetDirectContentUnder()Use this method to get the direct content under for this document.private PdfArraygetLastChildInNameTree(PdfDictionary dic)protected java.util.HashMap<java.lang.Object,PdfObject>getNamedDestinations()protected intgetNewObjectNumber(PdfReader reader, int number, int generation)(package private) PdfContentBytegetOverContent(int pageNum)PdfIndirectReferencegetPageReference(int page)Use this method to get a reference to a page existing or not.(package private) PdfStamperImp.PageStampgetPageStamp(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.PdfReadergetPdfReader()(package private) RandomAccessFileOrArraygetReaderFile(PdfReader reader)(package private) PdfContentBytegetUnderContent(int pageNum)(package private) voidinsertPage(int pageNumber, Rectangle mediabox)(package private) booleanisAppend()Getter for property append.(package private) booleanisContentWritten()(package private) booleanisRotateContents()Getter for property rotateContents.(package private) voidmakePackage(PdfCollection collection)Adds or replaces the Collection Dictionary in the Catalog.protected voidmarkUsed(int num)protected voidmarkUsed(PdfObject obj)private static voidmoveRectangle(PdfDictionary dic2, PdfReader r, int pageImported, PdfName key, java.lang.String name)private voidoutlineTravel(PRIndirectReference outline)(package private) booleanpartialFormFlattening(java.lang.String name)protected voidreadColorProfile()protected voidreadOCProperties()Reads the OCProperties dictionary from the catalog of the existing document and fills the documentOCG, documentOCGorder and OCGRadioGroup variables in PdfWriter.(package private) voidregisterLayer(PdfOCG layer)voidregisterReader(PdfReader reader, boolean openFile)(package private) voidreplacePage(PdfReader r, int pageImported, int pageReplaced)voidsetAdditionalAction(PdfName actionType, PdfAction action)Additional-actions defining the actions to be taken in response to various trigger events affecting the document as a whole.voidsetDuration(int seconds)Always throws anUnsupportedOperationException.(package private) voidsetDuration(int seconds, int page)Sets the display duration for the page (for presentations)voidsetFlatAnnotations(boolean flatAnnotations)If true, annotations with an appearance stream will be flattened.(package private) voidsetFormFlattening(boolean flat)(package private) voidsetFreeTextFlattening(boolean flat)protected voidsetJavaScript()voidsetOpenAction(PdfAction action)When the document opens thisactionwill be invoked.voidsetOpenAction(java.lang.String name)When the document opens it will jump to the destination with this name.protected voidsetOutlines()voidsetPageAction(PdfName actionType, PdfAction action)Always throws anUnsupportedOperationException.(package private) voidsetPageAction(PdfName actionType, PdfAction action, int page)Sets the open and close page additional action.(package private) voidsetRotateContents(boolean rotateContents)Setter for property rotateContents.voidsetSigFlags(int f)Set the signature flags.voidsetThumbnail(Image image)Use this method to set the thumbnail image for the current page.(package private) voidsetThumbnail(Image image, int page)voidsetTransition(PdfTransition transition)Always throws anUnsupportedOperationException.(package private) voidsetTransition(PdfTransition transition, int page)Sets the transition for the pageprotected voidsetViewerPreferences()voidsetViewerPreferences(int preferences)Sets the viewer preferences.(package private) voidsweepKids(PdfObject obj)private RectangletransformBBoxByMatrix(Rectangle bBox, double[] matrix)private PointtransformPoint(double x, double y, double[] matrix)voidunRegisterReader(PdfReader reader)protected voidupdateNamedDestinations()-
Methods inherited from class com.itextpdf.text.pdf.PdfWriter
add, add, add, addCalculationOrder, addDeveloperExtension, addDirectImageSimple, addDirectImageSimple, addDirectTemplateSimple, addFileAttachment, addFileAttachment, addFileAttachment, addJavaScript, addJavaScript, addJavaScript, addJavaScript, addJavaScript, addJavaScript, addLocalDestinations, addNamedDestination, addNamedDestinations, addOCGRadioGroup, addPageDictEntry, addSharedObjectsToBody, addSimple, addSimple, addSimpleExtGState, addSimplePattern, addSimplePatternColorspace, addSimpleProperty, addSimpleShading, addSimpleShadingPattern, addToBody, addToBody, addToBody, addToBody, addToBody, addToBody, addXFormsToBody, buildStructTreeRootForTagged, cacheObject, checkElementRole, checkPdfIsoConformance, checkPdfIsoConformance, clearTextWrap, close, createAnnotation, createAnnotation, createAnnotation, createXmpWriter, createXmpWriter, eliminateFontSubset, fillOCProperties, flushAcroFields, flushTaggedObjects, freeReader, getAcroForm, getBoxSize, getBoxSize, getCatalog, getColorProfile, getColorspaceName, getCompressionLevel, getCurrentDocumentSize, getCurrentPage, getCurrentPageNumber, getDefaultColorspace, getEncryption, getExtraCatalog, getGroup, getImageReference, getImportedPage, getIndirectReferenceNumber, getInfo, getInstance, getInstance, getNameString, getOCProperties, getOs, getPageDictEntries, getPageEvent, getPageNumber, getPageSize, getPdfDocument, getPdfIndirectReference, getPdfReaderInstance, getPdfVersion, getPDFXConformance, getReferenceJBIG2Globals, getRootOutline, getRunDirection, getSpaceCharRatio, getStandardStructElems, getStructureTreeRoot, getTabs, getTtfUnicodeWriter, getVerticalPosition, getXmpWriter, initPdfIsoConformance, isFullCompression, isPageEmpty, isPdfIso, isPdfX, isRgbTransparencyBlending, isStrictImageSequence, isTagged, isUserProperties, lockLayer, needToBeMarkedInContent, open, propertyExists, releaseTemplate, reorderPages, resetContent, resetPageDictEntries, setAtLeastPdfVersion, setBoxSize, setCollection, setCompressionLevel, setCropBoxSize, setDefaultColorspace, setEncryption, setEncryption, setEncryption, setEncryption, setEncryption, setFullCompression, setGroup, setInitialLeading, setLanguage, setLinearPageMode, setOutlines, setOutputIntents, setOutputIntents, setOutputIntents, setPageEmpty, setPageEvent, setPageLabels, setPageViewport, setPageXmpMetadata, setPdfVersion, setPdfVersion, setPDFXConformance, setRgbTransparencyBlending, setRunDirection, setSpaceCharRatio, setStrictImageSequence, setTabs, setTagged, setTagged, setUserProperties, setUserunit, setXmpMetadata, useExternalCacheForTagStructure, writeKeyInfo, 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
-
-
-
-
Field Detail
-
readers2intrefs
java.util.HashMap<PdfReader,IntHashtable> readers2intrefs
-
readers2file
java.util.HashMap<PdfReader,RandomAccessFileOrArray> readers2file
-
file
protected RandomAccessFileOrArray file
-
reader
PdfReader reader
-
myXref
IntHashtable myXref
-
pagesToContent
java.util.HashMap<PdfDictionary,PdfStamperImp.PageStamp> pagesToContent
Integer(page number) -> PageStamp
-
closed
protected boolean closed
-
rotateContents
private boolean rotateContents
Holds value of property rotateContents.
-
acroFields
protected AcroFields acroFields
-
flat
protected boolean flat
-
flatFreeText
protected boolean flatFreeText
-
flatannotations
protected boolean flatannotations
-
namePtr
protected int[] namePtr
-
partialFlattening
protected java.util.HashSet<java.lang.String> partialFlattening
-
useVp
protected boolean useVp
-
viewerPreferences
protected PdfViewerPreferencesImp viewerPreferences
-
fieldTemplates
protected java.util.HashSet<PdfTemplate> 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
-
namedDestinations
protected java.util.HashMap<java.lang.Object,PdfObject> namedDestinations
-
COUNTER
protected Counter COUNTER
-
logger
private Logger logger
-
originalLayersAreRead
private boolean originalLayersAreRead
-
builtInAnnotationFonts
private java.util.HashMap<java.lang.String,PdfIndirectReference> builtInAnnotationFonts
-
fromShortToFullAnnotationFontNames
private static java.util.HashMap<java.lang.String,java.lang.String> fromShortToFullAnnotationFontNames
-
DEFAULT_MATRIX
private double[] DEFAULT_MATRIX
-
-
Constructor Detail
-
PdfStamperImp
protected 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
-
getCounter
protected Counter getCounter()
- Overrides:
getCounterin classPdfWriter
-
readColorProfile
protected void readColorProfile()
-
setViewerPreferences
protected void setViewerPreferences()
-
close
protected void close(java.util.Map<java.lang.String,java.lang.String> moreInfo) throws java.io.IOException- Throws:
java.io.IOException
-
close
protected void close(PdfIndirectReference info, int skipInfo) throws java.io.IOException
- Throws:
java.io.IOException
-
applyRotation
void applyRotation(PdfDictionary pageN, ByteBuffer out)
-
alterContents
protected 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:
getNewObjectNumberin classPdfWriter
-
getReaderFile
RandomAccessFileOrArray getReaderFile(PdfReader reader)
- Overrides:
getReaderFilein classPdfWriter
-
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-
-
findAllObjects
static void findAllObjects(PdfReader reader, PdfObject obj, IntHashtable hits)
-
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)
-
moveRectangle
private static void moveRectangle(PdfDictionary dic2, PdfReader r, int pageImported, PdfName key, java.lang.String name)
-
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
protected void flatFields()
-
eliminateAcroformObjects
void eliminateAcroformObjects()
-
calculateTemplateTransformationMatrix
private AffineTransform calculateTemplateTransformationMatrix(AffineTransform currentMatrix, double fieldRotation, Rectangle box)
-
sweepKids
void sweepKids(PdfObject obj)
-
setFlatAnnotations
public void setFlatAnnotations(boolean flatAnnotations)
If true, annotations with an appearance stream will be flattened.- Parameters:
flatAnnotations- boolean- Since:
- 5.5.3
-
flattenAnnotations
protected void flattenAnnotations()
If setFlatAnnotations is set to true, iText will flatten all annotations with an appearance stream- Since:
- 5.5.3
-
flattenAnnotations
private void flattenAnnotations(boolean flattenFreeTextAnnotations)
-
transformPoint
private Point transformPoint(double x, double y, double[] matrix)
-
flatFreeTextFields
protected void flatFreeTextFields()
-
getPageReference
public PdfIndirectReference getPageReference(int page)
Description copied from class:PdfWriterUse 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:
getPageReferencein classPdfWriter- Parameters:
page- the page number. The first page is 1- Returns:
- the reference to the page
- See Also:
PdfWriter.getPageReference(int)
-
addAnnotation
public void addAnnotation(PdfAnnotation annot)
Description copied from interface:PdfAnnotationsUse this methods to add aPdfAnnotationor aPdfFormFieldto the document. Only the top parent of aPdfFormFieldneeds to be added.- Specified by:
addAnnotationin interfacePdfAnnotations- Overrides:
addAnnotationin classPdfWriter- Parameters:
annot- thePdfAnnotationor thePdfFormFieldto add- See Also:
PdfWriter.addAnnotation(com.itextpdf.text.pdf.PdfAnnotation)
-
addDocumentField
void addDocumentField(PdfIndirectReference ref)
-
addFieldResources
protected void addFieldResources() throws java.io.IOException- Throws:
java.io.IOException
-
expandFields
void expandFields(PdfFormField field, java.util.ArrayList<PdfAnnotation> allAnnots)
-
addAnnotation
void addAnnotation(PdfAnnotation annot, PdfDictionary pageN)
-
addAnnotation
void addAnnotation(PdfAnnotation annot, int page)
- Overrides:
addAnnotationin classPdfWriter
-
outlineTravel
private void outlineTravel(PRIndirectReference outline)
-
deleteOutlines
void deleteOutlines()
-
setJavaScript
protected void setJavaScript() throws java.io.IOException- Throws:
java.io.IOException
-
addFileAttachments
protected 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
protected void setOutlines() throws java.io.IOException- Throws:
java.io.IOException
-
setViewerPreferences
public void setViewerPreferences(int preferences)
Sets the viewer preferences.- Specified by:
setViewerPreferencesin interfacePdfViewerPreferences- Overrides:
setViewerPreferencesin 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:
addViewerPreferencein interfacePdfViewerPreferences- Overrides:
addViewerPreferencein classPdfWriter- Parameters:
key- a key for a viewer preferencevalue- the value for the viewer preference- See Also:
PdfViewerPreferences.addViewerPreference(com.itextpdf.text.pdf.PdfName, com.itextpdf.text.pdf.PdfObject)
-
setSigFlags
public void setSigFlags(int f)
Set the signature flags.- Specified by:
setSigFlagsin interfacePdfAnnotations- Overrides:
setSigFlagsin 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:
setPageActionin interfacePdfPageActions- Overrides:
setPageActionin 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_OPENorPdfWriter.PAGE_CLOSEaction- 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:
setDurationin interfacePdfPageActions- Overrides:
setDurationin classPdfWriter- Parameters:
seconds- ignore- See Also:
PdfPageActions.setDuration(int)
-
setTransition
public void setTransition(PdfTransition transition)
Always throws anUnsupportedOperationException.- Specified by:
setTransitionin interfacePdfPageActions- Overrides:
setTransitionin classPdfWriter- Parameters:
transition- ignore- See Also:
PdfPageActions.setTransition(com.itextpdf.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. Anullremoves 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.
-
getPdfReader
public PdfReader getPdfReader()
-
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_PRINTandDID_PRINT.- Specified by:
setAdditionalActionin interfacePdfDocumentActions- Overrides:
setAdditionalActionin 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.itextpdf.text.pdf.PdfName, com.itextpdf.text.pdf.PdfAction)
-
setOpenAction
public void setOpenAction(PdfAction action)
Description copied from interface:PdfDocumentActionsWhen the document opens thisactionwill be invoked.- Specified by:
setOpenActionin interfacePdfDocumentActions- Overrides:
setOpenActionin classPdfWriter- Parameters:
action- the action to be invoked- See Also:
PdfWriter.setOpenAction(com.itextpdf.text.pdf.PdfAction)
-
setOpenAction
public void setOpenAction(java.lang.String name)
Description copied from interface:PdfDocumentActionsWhen the document opens it will jump to the destination with this name.- Specified by:
setOpenActionin interfacePdfDocumentActions- Overrides:
setOpenActionin 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:PdfWriterUse this method to set the thumbnail image for the current page.- Overrides:
setThumbnailin classPdfWriter- Parameters:
image- the image- See Also:
PdfWriter.setThumbnail(com.itextpdf.text.Image)
-
setThumbnail
void setThumbnail(Image image, int page) throws PdfException, DocumentException
- Throws:
PdfExceptionDocumentException
-
getDirectContentUnder
public PdfContentByte getDirectContentUnder()
Description copied from class:PdfWriterUse 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:
getDirectContentUnderin classPdfWriter- Returns:
- the direct content
-
getDirectContent
public PdfContentByte getDirectContent()
Description copied from class:PdfWriterUse 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:
getDirectContentin 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
-
registerLayer
void registerLayer(PdfOCG layer)
- Overrides:
registerLayerin classPdfWriter
-
createXmpMetadata
public void createXmpMetadata()
Description copied from class:PdfWriterUse this method to creates XMP Metadata based on the metadata in the PdfDocument.- Overrides:
createXmpMetadatain classPdfWriter
-
getNamedDestinations
protected java.util.HashMap<java.lang.Object,PdfObject> getNamedDestinations()
-
updateNamedDestinations
protected void updateNamedDestinations() throws java.io.IOException- Throws:
java.io.IOException
-
getLastChildInNameTree
private PdfArray getLastChildInNameTree(PdfDictionary dic)
-
-