Class PdfStamperImp
- java.lang.Object
-
- com.gitlab.pdftk_java.com.lowagie.text.DocWriter
-
- com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfWriter
-
- com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfStamperImp
-
- All Implemented Interfaces:
DocListener,ElementListener,EventListener
public class PdfStamperImp extends PdfWriter
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfWriter
PdfWriter.PdfBody
-
-
Field Summary
Fields Modifier and Type Field Description protected AcroFieldsacroFieldsprotected booleanappendprotected booleanfieldsAddedprotected HashMapfieldTemplatesprotected booleanflatprotected booleanflatFreeTextprotected intinitialXrefSizeprotected IntHashtablemarkedprotected booleannamedAsNamesprotected int[]namePtrprotected ListnewBookmarksprotected PdfActionopenActionprotected HashSetpartialFlatteningprotected intsigFlagsprotected booleanuseVpprotected intvp-
Fields inherited from class com.gitlab.pdftk_java.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, AllowAssembly, AllowCopy, AllowDegradedPrinting, AllowFillIn, AllowModifyAnnotations, AllowModifyContents, AllowPrinting, AllowScreenReaders, body, CenterWindow, colorNumber, compressStreams, crypto, currentPageNumber, currentPdfReaderInstance, defaultColorspace, DID_PRINT, DID_SAVE, 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, fileID, filterStreams, FitWindow, fontNumber, formXObjects, formXObjectsCounter, fullCompression, GENERATION_MAX, group, HEADER, HideMenubar, HideToolbar, HideWindowUI, imageDictionary, importedPages, INVALID_ENCRYPTION, 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_VERSION_1_2, PDF_VERSION_1_3, PDF_VERSION_1_4, PDF_VERSION_1_5, PDF_VERSION_1_6, PDF_VERSION_1_7, PDFX1A2001, PDFX32002, PDFXNONE, prevxref, PrintScalingNone, 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, tagged, userunit, VERSION_1_0, VERSION_1_1, 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, OutputStream os, char pdfVersion, boolean append)Creates new PdfStamperImp.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAnnotation(PdfAnnotation annot)Adds aPdfAnnotationor aPdfFormFieldto the document.voidaddAnnotation(PdfAnnotation annot, int page)voidaddComments(FdfReader fdf)voidclose()Signals that theDocumentwas closed and that no otherElementswill be added.voidclose(HashMap moreInfo)AcroFieldsgetAcroFields()protected intgetNewObjectNumber(PdfReader reader, int number, int generation)PdfContentBytegetOverContent(int pageNum)PdfIndirectReferencegetPageReference(int page)Gets a reference to a page existing or not.PdfContentBytegetUnderContent(int pageNum)protected voidmarkUsed(int num)protected voidmarkUsed(PdfObject obj)voidregisterReader(PdfReader reader, boolean openFile)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.voidsetFormFlattening(boolean flat)voidsetOpenAction(PdfAction action)When the document opens thisactionwill be invoked.voidsetOpenAction(String name)When the document opens it will jump to the destination with this name.voidsetPageAction(PdfName actionType, PdfAction action)Always throws anUnsupportedOperationException.voidsetSigFlags(int f)Set the signature flags.voidsetTransition(PdfTransition transition)Always throws anUnsupportedOperationException.voidsetViewerPreferences(int preferences)Sets the viewer preferences.voidunRegisterReader(PdfReader reader)-
Methods inherited from class com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfWriter
addCalculationOrder, addJavaScript, addJavaScript, addJavaScript, addOCGRadioGroup, addSharedObjectsToBody, addToBody, addToBody, addToBody, addToBody, addToBody, addToBody, freeReader, getAcroForm, getCatalog, getCurrentDocumentSize, getDefaultColorspace, getDirectContent, getDirectContentUnder, getExtraCatalog, getFileID, getGroup, getImportedPage, getInfo, getOCProperties, getOs, getPageEvent, getPageNumber, getPdfDocument, getPdfIndirectReference, getPDFXConformance, getRoot, getRootOutline, getRunDirection, getSpaceCharRatio, getStructureTreeRoot, getUserunit, getVerticalPosition, isFullCompression, isStrictImageSequence, isTagged, open, releaseTemplate, reorderPages, setBoxSize, setCropBoxSize, setDefaultColorspace, setEncryption, setEncryption, setFileID, setFullCompression, setGroup, setLinearPageMode, setOutputIntents, setOutputIntents, setPageEmpty, setPageEvent, setPageLabels, setPdfVersion, setPDFXConformance, setRunDirection, setSpaceCharRatio, setStrictImageSequence, setTagged, setUserunit, setXmpMetadata
-
Methods inherited from class com.gitlab.pdftk_java.com.lowagie.text.DocWriter
add, addTabs, clearTextWrap, flush, getISOBytes, hasMarkupAttributes, isCloseStream, newPage, pause, resetFooter, resetHeader, resetPageCount, resume, setCloseStream, setMarginMirroring, 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
-
namedAsNames
protected boolean namedAsNames
-
newBookmarks
protected List newBookmarks
-
partialFlattening
protected HashSet partialFlattening
-
useVp
protected boolean useVp
-
vp
protected int vp
-
fieldTemplates
protected HashMap 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
-
-
Constructor Detail
-
PdfStamperImp
public PdfStamperImp(PdfReader reader, OutputStream os, char pdfVersion, boolean append) throws DocumentException, 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 errorIOException
-
-
Method Detail
-
close
public void close(HashMap moreInfo) throws DocumentException, IOException
- Throws:
DocumentExceptionIOException
-
close
public void close()
Description copied from class:PdfWriterSignals that theDocumentwas closed and that no otherElementswill 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.
- Specified by:
closein interfaceDocListener- Overrides:
closein classPdfWriter
-
getNewObjectNumber
protected int getNewObjectNumber(PdfReader reader, int number, int generation)
- Overrides:
getNewObjectNumberin classPdfWriter
-
registerReader
public void registerReader(PdfReader reader, boolean openFile) throws IOException
- Parameters:
reader-openFile-- Throws:
IOException
-
unRegisterReader
public void unRegisterReader(PdfReader reader)
- Parameters:
reader-
-
addComments
public void addComments(FdfReader fdf) throws IOException
- Parameters:
fdf-- Throws:
IOException
-
getUnderContent
public PdfContentByte getUnderContent(int pageNum)
-
getOverContent
public PdfContentByte getOverContent(int pageNum)
-
getAcroFields
public AcroFields getAcroFields()
-
setFormFlattening
public void setFormFlattening(boolean flat)
-
getPageReference
public PdfIndirectReference getPageReference(int page)
Description copied from class:PdfWriterGets 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 class:PdfWriterAdds aPdfAnnotationor aPdfFormFieldto the document. Only the top parent of aPdfFormFieldneeds to be added.- Overrides:
addAnnotationin classPdfWriter- Parameters:
annot- thePdfAnnotationor thePdfFormFieldto add- See Also:
PdfWriter.addAnnotation(com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfAnnotation)
-
addAnnotation
public void addAnnotation(PdfAnnotation annot, int page)
-
setViewerPreferences
public void setViewerPreferences(int preferences)
Sets the viewer preferences.- Overrides:
setViewerPreferencesin classPdfWriter- Parameters:
preferences- the viewer preferences- See Also:
PdfWriter.setViewerPreferences(int)
-
setSigFlags
public void setSigFlags(int f)
Set the signature flags.- Overrides:
setSigFlagsin classPdfWriter- Parameters:
f- the flags. This flags are ORed with current ones
-
setPageAction
public void setPageAction(PdfName actionType, PdfAction action) throws PdfException
Always throws anUnsupportedOperationException.- Overrides:
setPageActionin classPdfWriter- Parameters:
actionType- ignoreaction- ignore- Throws:
PdfException- ignore- See Also:
PdfStamper.setPageAction(PdfName, PdfAction, int)
-
setDuration
public void setDuration(int seconds)
Always throws anUnsupportedOperationException.- Overrides:
setDurationin classPdfWriter- Parameters:
seconds- ignore
-
setTransition
public void setTransition(PdfTransition transition)
Always throws anUnsupportedOperationException.- Overrides:
setTransitionin classPdfWriter- Parameters:
transition- ignore
-
markUsed
protected void markUsed(PdfObject obj)
-
markUsed
protected void markUsed(int num)
-
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.- Overrides:
setAdditionalActionin classPdfWriter- Parameters:
actionType- the action typeaction- the action to execute in response to the trigger- Throws:
PdfException- on invalid action type
-
setOpenAction
public void setOpenAction(PdfAction action)
Description copied from class:PdfWriterWhen the document opens thisactionwill be invoked.- Overrides:
setOpenActionin classPdfWriter- Parameters:
action- the action to be invoked- See Also:
PdfWriter.setOpenAction(com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfAction)
-
setOpenAction
public void setOpenAction(String name)
Description copied from class:PdfWriterWhen the document opens it will jump to the destination with this name.- Overrides:
setOpenActionin classPdfWriter- Parameters:
name- the name of the destination to jump to- See Also:
PdfWriter.setOpenAction(java.lang.String)
-
-