Package com.itextpdf.text.pdf
Class PdfAStamperImp
- java.lang.Object
-
- com.itextpdf.text.DocWriter
-
- com.itextpdf.text.pdf.PdfWriter
-
- com.itextpdf.text.pdf.PdfStamperImp
-
- com.itextpdf.text.pdf.PdfAStamperImp
-
- All Implemented Interfaces:
DocListener
,ElementListener
,PdfAnnotations
,PdfDocumentActions
,PdfEncryptionSettings
,PdfPageActions
,PdfRunDirection
,PdfVersion
,PdfViewerPreferences
,java.util.EventListener
public class PdfAStamperImp extends PdfStamperImp
Extension to PdfStamperImp that will attempt to keep a file in conformance with the PDF/A standard.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.itextpdf.text.pdf.PdfStamperImp
PdfStamperImp.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 Counter
COUNTER
(package private) XMPMeta
xmpMeta
-
Fields inherited from class com.itextpdf.text.pdf.PdfStamperImp
acroFields, append, closed, fieldsAdded, fieldTemplates, file, flat, flatannotations, flatFreeText, initialXrefSize, marked, myXref, namedDestinations, namePtr, openAction, pagesToContent, partialFlattening, reader, readers2file, readers2intrefs, sigFlags, useVp, viewerPreferences
-
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 Constructor Description PdfAStamperImp(PdfReader reader, java.io.OutputStream os, char pdfVersion, boolean append, PdfAConformanceLevel conformanceLevel)
Creates new PdfStamperImp.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
cacheObject(PdfIndirectObject iobj)
Use this method for caching objects.protected void
close(java.util.Map<java.lang.String,java.lang.String> moreInfo)
PdfAnnotation
createAnnotation(float llx, float lly, float urx, float ury, PdfAction action, PdfName subtype)
A wrapper around PdfAnnotation constructor.PdfAnnotation
createAnnotation(float llx, float lly, float urx, float ury, PdfString title, PdfString content, PdfName subtype)
A wrapper around PdfAnnotation constructor.PdfAnnotation
createAnnotation(Rectangle rect, PdfName subtype)
A wrapper around PdfAnnotation constructor.protected XmpWriter
createXmpWriter(java.io.ByteArrayOutputStream baos, PdfDictionary info)
protected XmpWriter
createXmpWriter(java.io.ByteArrayOutputStream baos, java.util.HashMap<java.lang.String,java.lang.String> info)
protected Counter
getCounter()
private PdfAChecker
getPdfAChecker()
protected TtfUnicodeWriter
getTtfUnicodeWriter()
XMPMeta
getXmpMeta()
protected PdfIsoConformance
initPdfIsoConformance()
protected void
readColorProfile()
private void
readPdfAInfo()
void
setOutputIntents(java.lang.String outputConditionIdentifier, java.lang.String outputCondition, java.lang.String registryName, java.lang.String info, ICC_Profile colorProfile)
Sets the values of the output intent dictionary.void
setPDFXConformance(int pdfx)
Always throws an exception since PDF/X conformance level cannot be set for PDF/A conformant documents.-
Methods inherited from class com.itextpdf.text.pdf.PdfStamperImp
addAnnotation, addAnnotation, addAnnotation, addComments, addDocumentField, addFieldResources, addFileAttachments, addViewerPreference, alterContents, alterResources, applyRotation, close, correctAcroFieldPages, createXmpMetadata, deleteOutlines, eliminateAcroformObjects, expandFields, findAllObjects, flatFields, flatFreeTextFields, flattenAnnotations, getAcroFields, getDirectContent, getDirectContentUnder, getNamedDestinations, getNewObjectNumber, getOverContent, getPageReference, getPageStamp, getPdfLayers, getPdfReader, getReaderFile, getUnderContent, insertPage, isAppend, isContentWritten, isRotateContents, makePackage, markUsed, markUsed, partialFormFlattening, readOCProperties, registerLayer, registerReader, replacePage, setAdditionalAction, setDuration, setDuration, setFlatAnnotations, setFormFlattening, setFreeTextFlattening, setJavaScript, setOpenAction, setOpenAction, setOutlines, setPageAction, setPageAction, setRotateContents, setSigFlags, setThumbnail, setThumbnail, setTransition, setTransition, setViewerPreferences, setViewerPreferences, sweepKids, unRegisterReader, updateNamedDestinations
-
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, checkElementRole, checkPdfIsoConformance, checkPdfIsoConformance, clearTextWrap, close, 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, getVerticalPosition, getXmpWriter, 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, setPageEmpty, setPageEvent, setPageLabels, setPageViewport, setPageXmpMetadata, setPdfVersion, setPdfVersion, 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
-
-
-
-
Constructor Detail
-
PdfAStamperImp
PdfAStamperImp(PdfReader reader, java.io.OutputStream os, char pdfVersion, boolean append, PdfAConformanceLevel conformanceLevel) throws DocumentException, java.io.IOException
Creates new PdfStamperImp.- Parameters:
reader
- reads the PDFos
- the output destinationpdfVersion
- the new pdf version or '\0' to keep the same version as the original documentappend
-conformanceLevel
- PDF/A conformance level of a new PDF document- Throws:
DocumentException
- on errorjava.io.IOException
-
-
Method Detail
-
readColorProfile
protected void readColorProfile()
- Overrides:
readColorProfile
in classPdfStamperImp
-
setOutputIntents
public void setOutputIntents(java.lang.String outputConditionIdentifier, java.lang.String outputCondition, java.lang.String registryName, java.lang.String info, ICC_Profile colorProfile) throws java.io.IOException
Description copied from class:PdfWriter
Sets the values of the output intent dictionary. Null values are allowed to suppress any key.- Overrides:
setOutputIntents
in classPdfWriter
- Parameters:
outputConditionIdentifier
- a valueoutputCondition
- a valueregistryName
- a valueinfo
- a valuecolorProfile
- a value- Throws:
java.io.IOException
- on error- See Also:
PdfWriter.setOutputIntents(String, String, String, String, ICC_Profile)
-
setPDFXConformance
public void setPDFXConformance(int pdfx)
Always throws an exception since PDF/X conformance level cannot be set for PDF/A conformant documents.- Overrides:
setPDFXConformance
in classPdfWriter
- Parameters:
pdfx
-- See Also:
PdfXConformance.setPDFXConformance(int)
-
getTtfUnicodeWriter
protected TtfUnicodeWriter getTtfUnicodeWriter()
- Overrides:
getTtfUnicodeWriter
in classPdfWriter
- See Also:
PdfWriter.getTtfUnicodeWriter()
-
createXmpWriter
protected XmpWriter createXmpWriter(java.io.ByteArrayOutputStream baos, PdfDictionary info) throws java.io.IOException
- Overrides:
createXmpWriter
in classPdfWriter
- Throws:
java.io.IOException
- See Also:
PdfWriter.createXmpWriter(java.io.ByteArrayOutputStream, com.itextpdf.text.pdf.PdfDictionary)
-
createXmpWriter
protected XmpWriter createXmpWriter(java.io.ByteArrayOutputStream baos, java.util.HashMap<java.lang.String,java.lang.String> info) throws java.io.IOException
- Overrides:
createXmpWriter
in classPdfWriter
- Throws:
java.io.IOException
-
initPdfIsoConformance
protected PdfIsoConformance initPdfIsoConformance()
- Overrides:
initPdfIsoConformance
in classPdfWriter
- See Also:
PdfWriter.initPdfIsoConformance()
-
getCounter
protected Counter getCounter()
- Overrides:
getCounter
in classPdfStamperImp
-
readPdfAInfo
private void readPdfAInfo()
-
cacheObject
protected void cacheObject(PdfIndirectObject iobj)
Description copied from class:PdfWriter
Use this method for caching objects.- Overrides:
cacheObject
in classPdfWriter
- See Also:
PdfIndirectObject
-
getPdfAChecker
private PdfAChecker getPdfAChecker()
-
close
protected void close(java.util.Map<java.lang.String,java.lang.String> moreInfo) throws java.io.IOException
- Overrides:
close
in classPdfStamperImp
- Throws:
java.io.IOException
-
createAnnotation
public PdfAnnotation createAnnotation(Rectangle rect, PdfName subtype)
Description copied from class:PdfWriter
A wrapper around PdfAnnotation constructor. It is recommended to use this wrapper instead of direct constructor as this is a convenient way to override PdfAnnotation construction when needed.- Overrides:
createAnnotation
in classPdfWriter
- Returns:
-
createAnnotation
public PdfAnnotation createAnnotation(float llx, float lly, float urx, float ury, PdfString title, PdfString content, PdfName subtype)
Description copied from class:PdfWriter
A wrapper around PdfAnnotation constructor. It is recommended to use this wrapper instead of direct constructor as this is a convenient way to override PdfAnnotation construction when needed.- Overrides:
createAnnotation
in classPdfWriter
- Returns:
-
createAnnotation
public PdfAnnotation createAnnotation(float llx, float lly, float urx, float ury, PdfAction action, PdfName subtype)
Description copied from class:PdfWriter
A wrapper around PdfAnnotation constructor. It is recommended to use this wrapper instead of direct constructor as this is a convenient way to override PdfAnnotation construction when needed.- Overrides:
createAnnotation
in classPdfWriter
- Returns:
-
getXmpMeta
public XMPMeta getXmpMeta()
-
-