DocListener
, ElementListener
, PdfAnnotations
, PdfDocumentActions
, PdfEncryptionSettings
, PdfPageActions
, PdfRunDirection
, PdfVersion
, PdfViewerPreferences
, java.util.EventListener
PdfAStamperImp
, PdfAWriter
, PdfCopy
public class PdfWriter extends DocWriter implements PdfViewerPreferences, PdfEncryptionSettings, PdfVersion, PdfDocumentActions, PdfPageActions, PdfRunDirection, PdfAnnotations
DocWriter
class for PDF.
When this PdfWriter
is added
to a certain PdfDocument
, the PDF representation of every Element
added to this Document will be written to the outputstream.
Modifier and Type | Class | Description |
---|---|---|
static class |
PdfWriter.PdfBody |
This class generates the structure of a PDF document.
|
static class |
PdfWriter.PdfTrailer |
PdfTrailer is the PDF Trailer object. |
Modifier and Type | Field | Description |
---|---|---|
static int |
ALLOW_ASSEMBLY |
The operation permitted when the document is opened with the user password
|
static int |
ALLOW_COPY |
The operation permitted when the document is opened with the user password
|
static int |
ALLOW_DEGRADED_PRINTING |
The operation permitted when the document is opened with the user password
|
static int |
ALLOW_FILL_IN |
The operation permitted when the document is opened with the user password
|
static int |
ALLOW_MODIFY_ANNOTATIONS |
The operation permitted when the document is opened with the user password
|
static int |
ALLOW_MODIFY_CONTENTS |
The operation permitted when the document is opened with the user password
|
static int |
ALLOW_PRINTING |
The operation permitted when the document is opened with the user password
|
static int |
ALLOW_SCREENREADERS |
The operation permitted when the document is opened with the user password
|
static int |
AllowAssembly |
Deprecated.
As of iText 2.0.7, use
ALLOW_ASSEMBLY instead. |
static int |
AllowCopy |
Deprecated.
As of iText 2.0.7, use
ALLOW_COPY instead. |
static int |
AllowDegradedPrinting |
Deprecated.
As of iText 2.0.7, use
ALLOW_DEGRADED_PRINTING instead. |
static int |
AllowFillIn |
Deprecated.
As of iText 2.0.7, use
ALLOW_FILL_IN instead. |
static int |
AllowModifyAnnotations |
Deprecated.
As of iText 2.0.7, use
ALLOW_MODIFY_ANNOTATIONS instead. |
static int |
AllowModifyContents |
Deprecated.
As of iText 2.0.7, use
ALLOW_MODIFY_CONTENTS instead. |
static int |
AllowPrinting |
Deprecated.
As of iText 2.0.7, use
ALLOW_PRINTING instead. |
static int |
AllowScreenReaders |
Deprecated.
As of iText 2.0.7, use
ALLOW_SCREENREADERS instead. |
protected PdfWriter.PdfBody |
body |
body of the PDF document
|
static int |
CenterWindow |
A viewer preference
|
protected int |
colorNumber |
The color number counter for the colors in the document.
|
protected ICC_Profile |
colorProfile |
|
protected int |
compressionLevel |
The compression level of the content streams.
|
protected static Counter |
COUNTER |
|
protected PdfEncryption |
crypto |
Contains the business logic for cryptography.
|
protected int |
currentPageNumber |
The current page number.
|
protected com.itextpdf.text.pdf.PdfReaderInstance |
currentPdfReaderInstance |
|
protected PdfDictionary |
defaultColorspace |
|
static PdfName |
DID_PRINT |
action value
|
static PdfName |
DID_SAVE |
action value
|
protected PdfContentByte |
directContent |
The direct content in this document.
|
protected PdfContentByte |
directContentUnder |
The direct content under in this document.
|
static int |
DirectionL2R |
A viewer preference
|
static int |
DirectionR2L |
A viewer preference
|
static int |
DisplayDocTitle |
A viewer preference
|
static int |
DO_NOT_ENCRYPT_METADATA |
Add this to the mode to keep the metadata in clear text
|
static PdfName |
DOCUMENT_CLOSE |
action value
|
protected java.util.HashMap<ICachedColorSpace,com.itextpdf.text.pdf.ColorDetails> |
documentColors |
The colors of this document
|
protected java.util.HashMap<PdfDictionary,PdfObject[]> |
documentExtGState |
|
protected java.util.LinkedHashMap<BaseFont,com.itextpdf.text.pdf.FontDetails> |
documentFonts |
The fonts of this document
|
protected java.util.LinkedHashSet<PdfOCG> |
documentOCG |
A hashSet containing all the PdfLayer objects.
|
protected java.util.ArrayList<PdfOCG> |
documentOCGorder |
An array list used to define the order of an OCG tree.
|
protected java.util.HashMap<PdfPatternPainter,PdfName> |
documentPatterns |
The patterns of this document
|
protected java.util.HashMap<java.lang.Object,PdfObject[]> |
documentProperties |
|
protected java.util.HashSet<PdfShadingPattern> |
documentShadingPatterns |
|
protected java.util.HashSet<PdfShading> |
documentShadings |
|
protected java.util.HashMap<com.itextpdf.text.pdf.ColorDetails,com.itextpdf.text.pdf.ColorDetails> |
documentSpotPatterns |
|
static int |
EMBEDDED_FILES_ONLY |
Add this to the mode to keep encrypt only the embedded files.
|
static int |
ENCRYPTION_AES_128 |
Type of encryption
|
static int |
ENCRYPTION_AES_256 |
Type of encryption
|
protected PdfDictionary |
extraCatalog |
Holds value of property extraCatalog this is used for Output Intents.
|
static int |
FitWindow |
A viewer preference
|
protected int |
fontNumber |
The font number counter for the fonts in the document.
|
protected java.util.HashMap<PdfIndirectReference,java.lang.Object[]> |
formXObjects |
The form XObjects in this document.
|
protected int |
formXObjectsCounter |
The name counter for the form XObjects name.
|
protected boolean |
fullCompression |
Holds value of property fullCompression.
|
static int |
GENERATION_MAX |
The highest generation number possible.
|
protected PdfDictionary |
group |
A group attributes dictionary specifying the attributes
of the page's page group for use in the transparent
imaging model
|
static int |
HideMenubar |
A viewer preference
|
static int |
HideToolbar |
A viewer preference
|
static int |
HideWindowUI |
A viewer preference
|
protected PdfDictionary |
imageDictionary |
Dictionary, containing all the images of the PDF document
|
protected java.util.HashMap<PdfStream,PdfIndirectReference> |
JBIG2Globals |
A HashSet with Stream objects containing JBIG2 Globals
|
static int |
markAll |
|
static int |
markInlineElementsOnly |
|
protected java.util.List<java.util.HashMap<java.lang.String,java.lang.Object>> |
newBookmarks |
|
static float |
NO_SPACE_CHAR_RATIO |
Disable the inter-character spacing.
|
static int |
NonFullScreenPageModeUseNone |
A viewer preference
|
static int |
NonFullScreenPageModeUseOC |
A viewer preference
|
static int |
NonFullScreenPageModeUseOutlines |
A viewer preference
|
static int |
NonFullScreenPageModeUseThumbs |
A viewer preference
|
protected PdfArray |
OCGLocked |
The locked array in an OCG dictionary
|
protected PdfArray |
OCGRadioGroup |
The RBGroups array in an OCG dictionary
|
protected PdfOCProperties |
OCProperties |
The OCProperties in a catalog dictionary.
|
protected byte[] |
originalFileID |
The original file ID (if present).
|
static PdfName |
PAGE_CLOSE |
action value
|
static PdfName |
PAGE_OPEN |
action value
|
protected PdfDictionary |
pageDictEntries |
Additional page dictionary entries.
|
static int |
PageLayoutOneColumn |
A viewer preference
|
static int |
PageLayoutSinglePage |
A viewer preference
|
static int |
PageLayoutTwoColumnLeft |
A viewer preference
|
static int |
PageLayoutTwoColumnRight |
A viewer preference
|
static int |
PageLayoutTwoPageLeft |
A viewer preference
|
static int |
PageLayoutTwoPageRight |
A viewer preference
|
static int |
PageModeFullScreen |
A viewer preference
|
static int |
PageModeUseAttachments |
A viewer preference
|
static int |
PageModeUseNone |
A viewer preference
|
static int |
PageModeUseOC |
A viewer preference
|
static int |
PageModeUseOutlines |
A viewer preference
|
static int |
PageModeUseThumbs |
A viewer preference
|
protected java.util.ArrayList<PdfIndirectReference> |
pageReferences |
The PdfIndirectReference to the pages.
|
protected com.itextpdf.text.pdf.ColorDetails |
patternColorspaceCMYK |
|
protected com.itextpdf.text.pdf.ColorDetails |
patternColorspaceGRAY |
|
protected com.itextpdf.text.pdf.ColorDetails |
patternColorspaceRGB |
|
protected int |
patternNumber |
The pattern number counter for the colors in the document.
|
protected PdfDocument |
pdf |
the pdfdocument object.
|
protected PdfVersionImp |
pdf_version |
Stores the version information for the header and the catalog.
|
static PdfName |
PDF_VERSION_1_2 |
possible PDF version (catalog)
|
static PdfName |
PDF_VERSION_1_3 |
possible PDF version (catalog)
|
static PdfName |
PDF_VERSION_1_4 |
possible PDF version (catalog)
|
static PdfName |
PDF_VERSION_1_5 |
possible PDF version (catalog)
|
static PdfName |
PDF_VERSION_1_6 |
possible PDF version (catalog)
|
static PdfName |
PDF_VERSION_1_7 |
possible PDF version (catalog)
|
protected PdfIsoConformance |
pdfIsoConformance |
Stores the PDF ISO conformance.
|
static int |
PDFX1A2001 |
A PDF/X level.
|
static int |
PDFX32002 |
A PDF/X level.
|
static int |
PDFXNONE |
A PDF/X level.
|
protected long |
prevxref |
A number referring to the previous Cross-Reference Table.
|
static int |
PrintScalingNone |
A viewer preference
|
protected java.util.HashMap<PdfReader,com.itextpdf.text.pdf.PdfReaderInstance> |
readerInstances |
Instances of PdfReader/PdfReaderInstance that are used to import pages.
|
protected PdfPages |
root |
The root of the page tree.
|
static int |
RUN_DIRECTION_DEFAULT |
Use the default run direction.
|
static int |
RUN_DIRECTION_LTR |
Use bidirectional reordering with left-to-right
preferential run direction.
|
static int |
RUN_DIRECTION_NO_BIDI |
Do not use bidirectional reordering.
|
static int |
RUN_DIRECTION_RTL |
Use bidirectional reordering with right-to-left
preferential run direction.
|
protected int |
runDirection |
|
static int |
SIGNATURE_APPEND_ONLY |
signature value
|
static int |
SIGNATURE_EXISTS |
signature value
|
static float |
SPACE_CHAR_RATIO_DEFAULT |
The default space-char ratio.
|
static int |
STANDARD_ENCRYPTION_128 |
Type of encryption
|
static int |
STANDARD_ENCRYPTION_40 |
Type of encryption
|
static boolean |
STRENGTH128BITS |
Deprecated.
As of iText 2.0.7, use
STANDARD_ENCRYPTION_128 instead. |
static boolean |
STRENGTH40BITS |
Deprecated.
As of iText 2.0.7, use
STANDARD_ENCRYPTION_40 instead. |
protected PdfStructureTreeRoot |
structureTreeRoot |
|
protected PdfName |
tabs |
The value of the Tabs entry in the page dictionary.
|
protected boolean |
tagged |
|
protected int |
taggingMode |
|
protected TtfUnicodeWriter |
ttfUnicodeWriter |
|
static char |
VERSION_1_2 |
possible PDF version (header)
|
static char |
VERSION_1_3 |
possible PDF version (header)
|
static char |
VERSION_1_4 |
possible PDF version (header)
|
static char |
VERSION_1_5 |
possible PDF version (header)
|
static char |
VERSION_1_6 |
possible PDF version (header)
|
static char |
VERSION_1_7 |
possible PDF version (header)
|
static PdfName |
WILL_PRINT |
action value
|
static PdfName |
WILL_SAVE |
action value
|
protected byte[] |
xmpMetadata |
XMP Metadata for the document.
|
protected XmpWriter |
xmpWriter |
Modifier | Constructor | Description |
---|---|---|
protected |
PdfWriter() |
Constructs a
PdfWriter . |
protected |
PdfWriter(PdfDocument document,
java.io.OutputStream os) |
Constructs a
PdfWriter . |
Modifier and Type | Method | Description |
---|---|---|
protected PdfIndirectReference |
add(PdfICCBased icc) |
|
void |
addAnnotation(PdfAnnotation annot) |
Use this methods to add a
PdfAnnotation or a PdfFormField
to the document. |
void |
addCalculationOrder(PdfFormField annot) |
Use this method to adds the
PdfAnnotation
to the calculation order array. |
void |
addDeveloperExtension(PdfDeveloperExtension de) |
Adds a developer extension to the Extensions dictionary
in the Catalog.
|
PdfName |
addDirectImageSimple(Image image) |
Use this method to adds an image to the document
but not to the page resources.
|
PdfName |
addDirectImageSimple(Image image,
PdfIndirectReference fixedRef) |
Adds an image to the document but not to the page resources.
|
void |
addFileAttachment(PdfFileSpecification fs) |
Use this method to add a file attachment at the document level.
|
void |
addFileAttachment(java.lang.String description,
byte[] fileStore,
java.lang.String file,
java.lang.String fileDisplay) |
Use this method to add a file attachment at the document level.
|
void |
addFileAttachment(java.lang.String description,
PdfFileSpecification fs) |
Use this method to add a file attachment at the document level.
|
void |
addJavaScript(PdfAction js) |
Use this method to add a JavaScript action at the document level.
|
void |
addJavaScript(java.lang.String code) |
Use this method to adds a JavaScript action at the document level.
|
void |
addJavaScript(java.lang.String code,
boolean unicode) |
Use this method to add a JavaScript action at the document level.
|
void |
addJavaScript(java.lang.String name,
PdfAction js) |
Use this method to add a JavaScript action at the document level.
|
void |
addJavaScript(java.lang.String name,
java.lang.String code) |
Use this method to adds a JavaScript action at the document level.
|
void |
addJavaScript(java.lang.String name,
java.lang.String code,
boolean unicode) |
Use this method to add a JavaScript action at the document level.
|
void |
addNamedDestination(java.lang.String name,
int page,
PdfDestination dest) |
Adds one named destination.
|
void |
addNamedDestinations(java.util.Map<java.lang.String,java.lang.String> map,
int page_offset) |
Adds named destinations in bulk.
|
void |
addOCGRadioGroup(java.util.ArrayList<PdfLayer> group) |
Use this method to set a collection of optional content groups
whose states are intended to follow a "radio button" paradigm.
|
void |
addPageDictEntry(PdfName key,
PdfObject object) |
Adds an additional entry for the page dictionary.
|
protected void |
addSharedObjectsToBody() |
|
PdfIndirectObject |
addToBody(PdfObject object) |
Use this method to add a PDF object to the PDF body.
|
PdfIndirectObject |
addToBody(PdfObject object,
boolean inObjStm) |
Use this method to add a PDF object to the PDF body.
|
PdfIndirectObject |
addToBody(PdfObject object,
int refNumber) |
Use this method to add a PDF object to the PDF body.
|
PdfIndirectObject |
addToBody(PdfObject object,
int refNumber,
boolean inObjStm) |
Use this method to add a PDF object to the PDF body.
|
PdfIndirectObject |
addToBody(PdfObject object,
PdfIndirectReference ref) |
Use this method to add a PDF object to the PDF body.
|
PdfIndirectObject |
addToBody(PdfObject object,
PdfIndirectReference ref,
boolean inObjStm) |
Use this method to add a PDF object to the PDF body.
|
void |
addViewerPreference(PdfName key,
PdfObject value) |
Adds a viewer preference.
|
protected void |
addXFormsToBody() |
|
protected void |
buildStructTreeRootForTagged(PdfDictionary catalog) |
|
protected void |
cacheObject(PdfIndirectObject iobj) |
Use this method for caching objects.
|
void |
checkElementRole(IAccessibleElement element,
IAccessibleElement parent) |
|
void |
checkPdfIsoConformance(int key,
java.lang.Object obj1) |
|
static void |
checkPdfIsoConformance(PdfWriter writer,
int key,
java.lang.Object obj1) |
|
void |
clearTextWrap() |
Use this method to clear text wrapping around images (if applicable).
|
void |
close() |
Signals that the
Document was closed and that no other
Elements will be added. |
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.
|
void |
createXmpMetadata() |
Use this method to creates XMP Metadata based
on the metadata in the PdfDocument.
|
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 void |
fillOCProperties(boolean erase) |
|
protected void |
flushAcroFields() |
|
protected void |
flushTaggedObjects() |
Fix structure of tagged document: remove unused objects, remove unused items from class map,
fix xref table due to removed objects.
|
void |
freeReader(PdfReader reader) |
Use this method to writes the reader to the document
and free the memory used by it.
|
PdfAcroForm |
getAcroForm() |
Use this methods to get the AcroForm object.
|
Rectangle |
getBoxSize(java.lang.String boxName) |
Use this method to get the size of a trim, art, crop or bleed box,
or null if not defined.
|
Rectangle |
getBoxSize(java.lang.String boxName,
Rectangle intersectingRectangle) |
Returns the intersection between the crop, trim art or bleed box and the parameter intersectingRectangle.
|
protected PdfDictionary |
getCatalog(PdfIndirectReference rootObj) |
|
ICC_Profile |
getColorProfile() |
|
int |
getCompressionLevel() |
Returns the compression level used for streams written by this writer.
|
protected Counter |
getCounter() |
|
long |
getCurrentDocumentSize() |
Use this method to gets the current document size.
|
int |
getCurrentPageNumber() |
|
PdfDictionary |
getDefaultColorspace() |
Use this method to get the default colorspaces.
|
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.
|
PdfDictionary |
getExtraCatalog() |
Sets extra keys to the catalog.
|
PdfDictionary |
getGroup() |
Use this method to get the group dictionary.
|
PdfImportedPage |
getImportedPage(PdfReader reader,
int pageNumber) |
Use this method to get a page from other PDF document.
|
protected int |
getIndirectReferenceNumber() |
|
PdfDictionary |
getInfo() |
Use this method to get the info dictionary if you want to
change it directly (add keys and values to the info dictionary).
|
static PdfWriter |
getInstance(Document document,
java.io.OutputStream os) |
Use this method to get an instance of the
PdfWriter . |
static PdfWriter |
getInstance(Document document,
java.io.OutputStream os,
DocListener listener) |
Use this method to get an instance of the
PdfWriter . |
protected static java.lang.String |
getNameString(PdfDictionary dic,
PdfName key) |
|
protected int |
getNewObjectNumber(PdfReader reader,
int number,
int generation) |
|
PdfOCProperties |
getOCProperties() |
Use this method to get the Optional Content Properties Dictionary.
|
OutputStreamCounter |
getOs() |
Returns the outputStreamCounter.
|
PdfDictionary |
getPageDictEntries() |
Gets the additional pageDictEntries.
|
PdfPageEvent |
getPageEvent() |
Gets the
PdfPageEvent for this document or null
if none is set. |
int |
getPageNumber() |
Gets the pagenumber of this document.
|
PdfIndirectReference |
getPageReference(int page) |
Use this method to get a reference to a page existing or not.
|
Rectangle |
getPageSize() |
Use this method to get the size of the media box.
|
PdfIndirectReference |
getPdfIndirectReference() |
Use this to get an
PdfIndirectReference for an object that
will be created in the future. |
protected com.itextpdf.text.pdf.PdfReaderInstance |
getPdfReaderInstance(PdfReader reader) |
Returns the PdfReaderInstance associated with the specified reader.
|
int |
getPDFXConformance() |
|
protected PdfIndirectReference |
getReferenceJBIG2Globals(byte[] content) |
Gets an indirect reference to a JBIG2 Globals stream.
|
PdfOutline |
getRootOutline() |
Use this method to get the root outline
and construct bookmarks.
|
int |
getRunDirection() |
Use this method to set the run direction.
|
float |
getSpaceCharRatio() |
Use this method to gets the space/character extra spacing ratio
for fully justified text.
|
java.util.List<PdfName> |
getStandardStructElems() |
Gets the list of the standard structure element names (roles).
|
PdfStructureTreeRoot |
getStructureTreeRoot() |
Gets the structure tree root.
|
PdfName |
getTabs() |
Returns the value to be used for the Tabs entry in the page tree.
|
protected TtfUnicodeWriter |
getTtfUnicodeWriter() |
|
float |
getVerticalPosition(boolean ensureNewLine) |
Use this method to get the current vertical page position.
|
XmpWriter |
getXmpWriter() |
|
protected PdfIsoConformance |
initPdfIsoConformance() |
|
boolean |
isFullCompression() |
Use this method to find out if 1.5 compression is on.
|
boolean |
isPageEmpty() |
Checks if a newPage() will actually generate a new page.
|
boolean |
isPdfIso() |
Checks if any PDF ISO conformance is necessary.
|
boolean |
isPdfX() |
|
boolean |
isRgbTransparencyBlending() |
Gets the transparency blending colorspace.
|
boolean |
isStrictImageSequence() |
Use this method to get the strictImageSequence status.
|
boolean |
isTagged() |
Check if the document is marked for tagging.
|
boolean |
isUserProperties() |
Gets the flag indicating the presence of structure elements that contain user properties attributes.
|
void |
lockLayer(PdfLayer layer) |
Use this method to lock an optional content group.
|
boolean |
needToBeMarkedInContent(IAccessibleElement element) |
|
void |
open() |
Signals that the
Document has been opened and that
Elements can be added. |
void |
releaseTemplate(PdfTemplate tp) |
Use this method to releases the memory used by a template.
|
int |
reorderPages(int[] order) |
Use this method to reorder the pages in the document.
|
void |
resetPageDictEntries() |
Resets the additional pageDictEntries.
|
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 |
setAtLeastPdfVersion(char version) |
If the PDF Header hasn't been written yet,
this changes the version as it will appear in the PDF Header,
but only if the parameter refers to a higher version.
|
void |
setBoxSize(java.lang.String boxName,
Rectangle size) |
Use this method to set the page box sizes.
|
void |
setCollection(PdfCollection collection) |
Use this method to add the Collection dictionary.
|
void |
setCompressionLevel(int compressionLevel) |
Sets the compression level to be used for streams written by this writer.
|
void |
setCropBoxSize(Rectangle crop) |
Use this method to set the crop box.
|
void |
setDefaultColorspace(PdfName key,
PdfObject cs) |
Use this method to sets the default colorspace that will be applied
to all the document.
|
void |
setDuration(int seconds) |
Sets the display duration for the page (for presentations)
|
void |
setEncryption(boolean strength,
java.lang.String userPassword,
java.lang.String ownerPassword,
int permissions) |
Deprecated.
As of iText 2.0.3, replaced by (@link #setEncryption(byte[], byte[], int, int)}.
|
void |
setEncryption(byte[] userPassword,
byte[] ownerPassword,
int permissions,
boolean strength128Bits) |
Deprecated.
As of iText 2.0.3, replaced by (@link #setEncryption(byte[], byte[], int, int)}.
|
void |
setEncryption(byte[] userPassword,
byte[] ownerPassword,
int permissions,
int encryptionType) |
Sets the encryption options for this document.
|
void |
setEncryption(int encryptionType,
java.lang.String userPassword,
java.lang.String ownerPassword,
int permissions) |
Deprecated.
As of iText 2.0.3, replaced by (@link #setEncryption(byte[], byte[], int, int)}.
|
void |
setEncryption(java.security.cert.Certificate[] certs,
int[] permissions,
int encryptionType) |
Sets the encryption options for this document.
|
void |
setFullCompression() |
Use this method to set the document's compression to the
PDF 1.5 mode with object streams and xref streams.
|
void |
setGroup(PdfDictionary group) |
Use this method to set the group dictionary.
|
void |
setInitialLeading(float leading) |
Sets the initial leading for the PDF document.
|
void |
setLanguage(java.lang.String language) |
|
void |
setLinearPageMode() |
Use this method to make sure the page tree has a linear structure
(every leave is attached directly to the root).
|
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.
|
void |
setOutlines(java.util.List<java.util.HashMap<java.lang.String,java.lang.Object>> outlines) |
Sets the bookmarks.
|
boolean |
setOutputIntents(PdfReader reader,
boolean checkExistence) |
Use this method to copy the output intent dictionary
from another document to this one.
|
void |
setOutputIntents(java.lang.String outputConditionIdentifier,
java.lang.String outputCondition,
java.lang.String registryName,
java.lang.String info,
byte[] destOutputProfile) |
Sets the values of the output intent dictionary.
|
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 |
setPageAction(PdfName actionType,
PdfAction action) |
Sets the open and close page additional action.
|
void |
setPageEmpty(boolean pageEmpty) |
Use this method to make sure a page is added,
even if it's empty.
|
void |
setPageEvent(PdfPageEvent event) |
Sets the
PdfPageEvent for this document. |
void |
setPageLabels(PdfPageLabels pageLabels) |
Use this method to add page labels
|
void |
setPageViewport(PdfArray vp) |
Sets the Viewport for the next page.
|
void |
setPageXmpMetadata(byte[] xmpMetadata) |
Use this method to set the XMP Metadata for each page.
|
void |
setPdfVersion(char version) |
If the PDF Header hasn't been written yet,
this changes the version as it will appear in the PDF Header.
|
void |
setPdfVersion(PdfName version) |
Sets the PDF version as it will appear in the Catalog.
|
void |
setPDFXConformance(int pdfx) |
|
void |
setRgbTransparencyBlending(boolean rgbTransparencyBlending) |
Sets the transparency blending colorspace to RGB.
|
void |
setRunDirection(int runDirection) |
Use this method to set the run direction.
|
void |
setSigFlags(int f) |
Use this method to set the signature flags.
|
void |
setSpaceCharRatio(float spaceCharRatio) |
Use this method to set the ratio between the extra word spacing and
the extra character spacing when the text is fully justified.
|
void |
setStrictImageSequence(boolean strictImageSequence) |
Use this method to set the image sequence, so that it follows
the text in strict order (or not).
|
void |
setTabs(PdfName tabs) |
Sets the value for the Tabs entry in the page tree.
|
void |
setTagged() |
Mark this document for tagging.
|
void |
setTagged(int taggingMode) |
|
void |
setThumbnail(Image image) |
Use this method to set the thumbnail image for the current page.
|
void |
setTransition(PdfTransition transition) |
Sets the transition for the page
|
void |
setUserProperties(boolean userProperties) |
Sets the flag indicating the presence of structure elements that contain user properties attributes.
|
void |
setUserunit(float userunit) |
Use this method to set the user unit.
|
void |
setViewerPreferences(int preferences) |
Sets the page layout and page mode preferences by ORing one or two of these constants.
|
void |
setXmpMetadata(byte[] xmpMetadata) |
Use this method to set the XMP Metadata.
|
void |
useExternalCacheForTagStructure(TempFileCache fileCache) |
|
protected static void |
writeKeyInfo(java.io.OutputStream os) |
|
protected void |
writeOutlines(PdfDictionary catalog,
boolean namedAsNames) |
add, addTabs, flush, getISOBytes, isCloseStream, isPaused, newPage, pause, resetPageCount, resume, setCloseStream, setMarginMirroring, setMarginMirroringTopBottom, setMargins, setPageCount, setPageSize, write, write, writeEnd, writeEnd, writeMarkupAttributes, writeStart
public static final int GENERATION_MAX
protected static Counter COUNTER
protected PdfDocument pdf
protected PdfContentByte directContent
protected PdfContentByte directContentUnder
protected PdfWriter.PdfBody body
protected ICC_Profile colorProfile
protected PdfDictionary extraCatalog
protected PdfPages root
protected java.util.ArrayList<PdfIndirectReference> pageReferences
protected int currentPageNumber
protected PdfName tabs
protected PdfDictionary pageDictEntries
protected long prevxref
protected byte[] originalFileID
protected java.util.List<java.util.HashMap<java.lang.String,java.lang.Object>> newBookmarks
public static final char VERSION_1_2
public static final char VERSION_1_3
public static final char VERSION_1_4
public static final char VERSION_1_5
public static final char VERSION_1_6
public static final char VERSION_1_7
public static final PdfName PDF_VERSION_1_2
public static final PdfName PDF_VERSION_1_3
public static final PdfName PDF_VERSION_1_4
public static final PdfName PDF_VERSION_1_5
public static final PdfName PDF_VERSION_1_6
public static final PdfName PDF_VERSION_1_7
protected PdfVersionImp pdf_version
public static final int PageLayoutSinglePage
public static final int PageLayoutOneColumn
public static final int PageLayoutTwoColumnLeft
public static final int PageLayoutTwoColumnRight
public static final int PageLayoutTwoPageLeft
public static final int PageLayoutTwoPageRight
public static final int PageModeUseNone
public static final int PageModeUseOutlines
public static final int PageModeUseThumbs
public static final int PageModeFullScreen
public static final int PageModeUseOC
public static final int PageModeUseAttachments
public static final int HideToolbar
public static final int HideMenubar
public static final int HideWindowUI
public static final int FitWindow
public static final int CenterWindow
public static final int DisplayDocTitle
public static final int NonFullScreenPageModeUseNone
public static final int NonFullScreenPageModeUseOutlines
public static final int NonFullScreenPageModeUseThumbs
public static final int NonFullScreenPageModeUseOC
public static final int DirectionL2R
public static final int DirectionR2L
public static final int PrintScalingNone
public static final PdfName DOCUMENT_CLOSE
public static final PdfName WILL_SAVE
public static final PdfName DID_SAVE
public static final PdfName WILL_PRINT
public static final PdfName DID_PRINT
public static final int SIGNATURE_EXISTS
public static final int SIGNATURE_APPEND_ONLY
protected byte[] xmpMetadata
protected XmpWriter xmpWriter
public static final int PDFXNONE
public static final int PDFX1A2001
public static final int PDFX32002
protected PdfIsoConformance pdfIsoConformance
public static final int STANDARD_ENCRYPTION_40
public static final int STANDARD_ENCRYPTION_128
public static final int ENCRYPTION_AES_128
public static final int ENCRYPTION_AES_256
public static final int DO_NOT_ENCRYPT_METADATA
public static final int EMBEDDED_FILES_ONLY
public static final int ALLOW_PRINTING
public static final int ALLOW_MODIFY_CONTENTS
public static final int ALLOW_COPY
public static final int ALLOW_MODIFY_ANNOTATIONS
public static final int ALLOW_FILL_IN
public static final int ALLOW_SCREENREADERS
public static final int ALLOW_ASSEMBLY
public static final int ALLOW_DEGRADED_PRINTING
@Deprecated public static final int AllowPrinting
ALLOW_PRINTING
instead. Scheduled for removal at or after 2.2.0@Deprecated public static final int AllowModifyContents
ALLOW_MODIFY_CONTENTS
instead. Scheduled for removal at or after 2.2.0@Deprecated public static final int AllowCopy
ALLOW_COPY
instead. Scheduled for removal at or after 2.2.0@Deprecated public static final int AllowModifyAnnotations
ALLOW_MODIFY_ANNOTATIONS
instead. Scheduled for removal at or after 2.2.0@Deprecated public static final int AllowFillIn
ALLOW_FILL_IN
instead. Scheduled for removal at or after 2.2.0@Deprecated public static final int AllowScreenReaders
ALLOW_SCREENREADERS
instead. Scheduled for removal at or after 2.2.0@Deprecated public static final int AllowAssembly
ALLOW_ASSEMBLY
instead. Scheduled for removal at or after 2.2.0@Deprecated public static final int AllowDegradedPrinting
ALLOW_DEGRADED_PRINTING
instead. Scheduled for removal at or after 2.2.0@Deprecated public static final boolean STRENGTH40BITS
STANDARD_ENCRYPTION_40
instead. Scheduled for removal at or after 2.2.0@Deprecated public static final boolean STRENGTH128BITS
STANDARD_ENCRYPTION_128
instead. Scheduled for removal at or after 2.2.0protected PdfEncryption crypto
protected boolean fullCompression
protected int compressionLevel
protected java.util.LinkedHashMap<BaseFont,com.itextpdf.text.pdf.FontDetails> documentFonts
protected int fontNumber
protected java.util.HashMap<PdfIndirectReference,java.lang.Object[]> formXObjects
protected int formXObjectsCounter
protected java.util.HashMap<PdfReader,com.itextpdf.text.pdf.PdfReaderInstance> readerInstances
protected com.itextpdf.text.pdf.PdfReaderInstance currentPdfReaderInstance
protected java.util.HashMap<ICachedColorSpace,com.itextpdf.text.pdf.ColorDetails> documentColors
protected int colorNumber
protected java.util.HashMap<PdfPatternPainter,PdfName> documentPatterns
protected int patternNumber
protected java.util.HashSet<PdfShadingPattern> documentShadingPatterns
protected java.util.HashSet<PdfShading> documentShadings
protected java.util.HashMap<PdfDictionary,PdfObject[]> documentExtGState
protected java.util.HashMap<java.lang.Object,PdfObject[]> documentProperties
public static final int markAll
public static final int markInlineElementsOnly
protected boolean tagged
protected int taggingMode
protected PdfStructureTreeRoot structureTreeRoot
protected java.util.LinkedHashSet<PdfOCG> documentOCG
protected java.util.ArrayList<PdfOCG> documentOCGorder
protected PdfOCProperties OCProperties
protected PdfArray OCGRadioGroup
protected PdfArray OCGLocked
public static final PdfName PAGE_OPEN
public static final PdfName PAGE_CLOSE
protected PdfDictionary group
public static final float SPACE_CHAR_RATIO_DEFAULT
public static final float NO_SPACE_CHAR_RATIO
public static final int RUN_DIRECTION_DEFAULT
public static final int RUN_DIRECTION_NO_BIDI
public static final int RUN_DIRECTION_LTR
public static final int RUN_DIRECTION_RTL
protected int runDirection
protected PdfDictionary defaultColorspace
protected java.util.HashMap<com.itextpdf.text.pdf.ColorDetails,com.itextpdf.text.pdf.ColorDetails> documentSpotPatterns
protected com.itextpdf.text.pdf.ColorDetails patternColorspaceRGB
protected com.itextpdf.text.pdf.ColorDetails patternColorspaceGRAY
protected com.itextpdf.text.pdf.ColorDetails patternColorspaceCMYK
protected PdfDictionary imageDictionary
protected java.util.HashMap<PdfStream,PdfIndirectReference> JBIG2Globals
protected TtfUnicodeWriter ttfUnicodeWriter
protected PdfWriter()
PdfWriter
.protected PdfWriter(PdfDocument document, java.io.OutputStream os)
PdfWriter
.
Remark: a PdfWriter can only be constructed by calling the method
getInstance(Document document, OutputStream os)
.
document
- The PdfDocument
that has to be writtenos
- The OutputStream
the writer has to write to.protected Counter getCounter()
public static PdfWriter getInstance(Document document, java.io.OutputStream os) throws DocumentException
PdfWriter
.document
- The Document
that has to be writtenos
- The OutputStream
the writer has to write to.PdfWriter
DocumentException
- on errorpublic static PdfWriter getInstance(Document document, java.io.OutputStream os, DocListener listener) throws DocumentException
PdfWriter
.document
- The Document
that has to be writtenos
- The OutputStream
the writer has to write to.listener
- A DocListener
to pass to the PdfDocument.PdfWriter
DocumentException
- on errorpublic PdfDictionary getInfo()
public float getVerticalPosition(boolean ensureNewLine)
ensureNewLine
- Tells whether a new line shall be enforced. This may cause side effects
for elements that do not terminate the lines they've started because those lines will get
terminated.public void setInitialLeading(float leading) throws DocumentException
leading
- the initial leadingDocumentException
- if you try setting the leading after the document was opened.public PdfContentByte getDirectContent()
public PdfContentByte getDirectContentUnder()
public ICC_Profile getColorProfile()
public PdfIndirectObject addToBody(PdfObject object) throws java.io.IOException
object
- java.io.IOException
public PdfIndirectObject addToBody(PdfObject object, boolean inObjStm) throws java.io.IOException
object
- inObjStm
- java.io.IOException
public PdfIndirectObject addToBody(PdfObject object, PdfIndirectReference ref) throws java.io.IOException
object
- ref
- java.io.IOException
public PdfIndirectObject addToBody(PdfObject object, PdfIndirectReference ref, boolean inObjStm) throws java.io.IOException
object
- ref
- inObjStm
- java.io.IOException
public PdfIndirectObject addToBody(PdfObject object, int refNumber) throws java.io.IOException
object
- refNumber
- java.io.IOException
public PdfIndirectObject addToBody(PdfObject object, int refNumber, boolean inObjStm) throws java.io.IOException
object
- refNumber
- inObjStm
- java.io.IOException
protected void cacheObject(PdfIndirectObject iobj)
iobj
- PdfIndirectObject
public PdfIndirectReference getPdfIndirectReference()
PdfIndirectReference
for an object that
will be created in the future.
Use this method only if you know what you're doing!PdfIndirectReference
protected int getIndirectReferenceNumber()
public OutputStreamCounter getOs()
protected PdfDictionary getCatalog(PdfIndirectReference rootObj)
protected void buildStructTreeRootForTagged(PdfDictionary catalog)
public PdfDictionary getExtraCatalog()
public void addPageDictEntry(PdfName key, PdfObject object)
key
- the keyobject
- the PdfObject for the given keypublic PdfDictionary getPageDictEntries()
public void resetPageDictEntries()
public void setLinearPageMode()
public int reorderPages(int[] order) throws DocumentException
null
argument value only returns the number of pages to process.
It is advisable to issue a Document.newPage()
before using this method.order
- an array with the new page sequence. It must have the
same size as the number of pages.DocumentException
- if all the pages are not present in the arraypublic PdfIndirectReference getPageReference(int page)
page
- the page number. The first page is 1public int getPageNumber()
public int getCurrentPageNumber()
public void setPageViewport(PdfArray vp)
vp
- an array consisting of Viewport dictionaries.public void setTabs(PdfName tabs)
tabs
- Can be PdfName.R, PdfName.C or PdfName.S.
Since the Adobe Extensions Level 3, it can also be PdfName.A
or PdfName.Wpublic PdfName getTabs()
public void setPageEvent(PdfPageEvent event)
PdfPageEvent
for this document.event
- the PdfPageEvent
for this documentpublic PdfPageEvent getPageEvent()
PdfPageEvent
for this document or null
if none is set.PdfPageEvent
for this document or null
if none is setpublic void open()
Document
has been opened and that
Elements
can be added.
When this method is called, the PDF-document header is written to the outputstream.
open
in interface DocListener
open
in class DocWriter
DocWriter.open()
public void close()
Document
was closed and that no other
Elements
will be added.
The pages-tree is built and written to the outputstream. A Catalog is constructed, as well as an Info-object, the reference table is composed and everything is written to the outputstream embedded in a Trailer.
close
in interface DocListener
close
in class DocWriter
DocWriter.close()
protected void addXFormsToBody() throws java.io.IOException
java.io.IOException
protected void addSharedObjectsToBody() throws java.io.IOException
java.io.IOException
public PdfOutline getRootOutline()
public void setOutlines(java.util.List<java.util.HashMap<java.lang.String,java.lang.Object>> outlines)
SimpleBookmark
.outlines
- the bookmarks or null
to remove anyprotected void writeOutlines(PdfDictionary catalog, boolean namedAsNames) throws java.io.IOException
java.io.IOException
public void setPdfVersion(char version)
PdfVersion
setPdfVersion
in interface PdfVersion
version
- a character representing the PDF versionPdfVersion.setPdfVersion(char)
public void setAtLeastPdfVersion(char version)
PdfVersion
setAtLeastPdfVersion
in interface PdfVersion
version
- a character representing the PDF versionPdfVersion.setAtLeastPdfVersion(char)
public void setPdfVersion(PdfName version)
PdfVersion
setPdfVersion
in interface PdfVersion
version
- the PDF name that will be used for the Version key in the catalogPdfVersion.setPdfVersion(com.itextpdf.text.pdf.PdfName)
public void addDeveloperExtension(PdfDeveloperExtension de)
PdfVersion
addDeveloperExtension
in interface PdfVersion
de
- an object that contains the extensions prefix and dictionaryPdfVersion.addDeveloperExtension(com.itextpdf.text.pdf.PdfDeveloperExtension)
public void setViewerPreferences(int preferences)
PdfViewerPreferences
addViewerPreference(key, value)
if you want to change the following preferences:
setViewerPreferences
in interface PdfViewerPreferences
preferences
- the viewer preferencesPdfViewerPreferences.setViewerPreferences(int)
public void addViewerPreference(PdfName key, PdfObject value)
PdfViewerPreferences
addViewerPreference
in interface PdfViewerPreferences
key
- the name of the viewer preferencevalue
- the value of the viewer preferencePdfViewerPreferences.addViewerPreference(com.itextpdf.text.pdf.PdfName, com.itextpdf.text.pdf.PdfObject)
public void setPageLabels(PdfPageLabels pageLabels)
pageLabels
- the page labelspublic void addNamedDestinations(java.util.Map<java.lang.String,java.lang.String> map, int page_offset)
map
- a map with strings as keys for the names,
and structured strings as values for the destinationspage_offset
- number of pages that has to be added to
the page numbers in the destinations (useful if you
use this method in combination with PdfCopy).public void addNamedDestination(java.lang.String name, int page, PdfDestination dest)
name
- the name for the destinationpage
- the page number where you want to jump todest
- an explicit destinationpublic void addJavaScript(PdfAction js)
js
- The JavaScript actionpublic void addJavaScript(java.lang.String code, boolean unicode)
code
- the JavaScript codeunicode
- select JavaScript unicode. Note that the internal
Acrobat JavaScript engine does not support unicode,
so this may or may not work for youpublic void addJavaScript(java.lang.String code)
code
- the JavaScript codepublic void addJavaScript(java.lang.String name, PdfAction js)
name
- The name of the JS Action in the name treejs
- The JavaScript actionpublic void addJavaScript(java.lang.String name, java.lang.String code, boolean unicode)
name
- The name of the JS Action in the name treecode
- the JavaScript codeunicode
- select JavaScript unicode. Note that the internal
Acrobat JavaScript engine does not support unicode,
so this may or may not work for youpublic void addJavaScript(java.lang.String name, java.lang.String code)
name
- The name of the JS Action in the name treecode
- the JavaScript codepublic void addFileAttachment(java.lang.String description, byte[] fileStore, java.lang.String file, java.lang.String fileDisplay) throws java.io.IOException
description
- the file descriptionfileStore
- an array with the file. If it's null
the file will be read from the diskfile
- the path to the file. It will only be used if
fileStore
is not null
fileDisplay
- the actual file name stored in the pdfjava.io.IOException
- on errorpublic void addFileAttachment(java.lang.String description, PdfFileSpecification fs) throws java.io.IOException
description
- the file descriptionfs
- the file specificationjava.io.IOException
- if the file attachment could not be added to the documentpublic void addFileAttachment(PdfFileSpecification fs) throws java.io.IOException
fs
- the file specificationjava.io.IOException
- if the file attachment could not be added to the documentpublic void setOpenAction(java.lang.String name)
PdfDocumentActions
setOpenAction
in interface PdfDocumentActions
name
- the name of the destination to jump toPdfDocumentActions.setOpenAction(java.lang.String)
public void setOpenAction(PdfAction action)
PdfDocumentActions
action
will be
invoked.setOpenAction
in interface PdfDocumentActions
action
- the action to be invokedPdfDocumentActions.setOpenAction(com.itextpdf.text.pdf.PdfAction)
public void setAdditionalAction(PdfName actionType, PdfAction action) throws DocumentException
PdfDocumentActions
DOCUMENT_CLOSE
,
WILL_SAVE
, DID_SAVE
, WILL_PRINT
and DID_PRINT
.setAdditionalAction
in interface PdfDocumentActions
actionType
- the action typeaction
- the action to execute in response to the triggerDocumentException
- on invalid action typePdfDocumentActions.setAdditionalAction(com.itextpdf.text.pdf.PdfName, com.itextpdf.text.pdf.PdfAction)
public void setCollection(PdfCollection collection)
collection
- a dictionary of type PdfCollectionpublic PdfAcroForm getAcroForm()
PdfAnnotations
getAcroForm
in interface PdfAnnotations
PdfAnnotations.getAcroForm()
public void addAnnotation(PdfAnnotation annot)
PdfAnnotations
PdfAnnotation
or a PdfFormField
to the document. Only the top parent of a PdfFormField
needs to be added.addAnnotation
in interface PdfAnnotations
annot
- the PdfAnnotation
or the PdfFormField
to addPdfAnnotations.addAnnotation(com.itextpdf.text.pdf.PdfAnnotation)
public void addCalculationOrder(PdfFormField annot)
PdfAnnotations
PdfAnnotation
to the calculation order array.addCalculationOrder
in interface PdfAnnotations
annot
- the PdfAnnotation
to be addedPdfAnnotations.addCalculationOrder(com.itextpdf.text.pdf.PdfFormField)
public void setSigFlags(int f)
PdfAnnotations
setSigFlags
in interface PdfAnnotations
f
- the flags. This flags are ORed with current onesPdfAnnotations.setSigFlags(int)
public void setLanguage(java.lang.String language)
public void setXmpMetadata(byte[] xmpMetadata)
xmpMetadata
- The xmpMetadata to set.public void setPageXmpMetadata(byte[] xmpMetadata) throws java.io.IOException
xmpMetadata
- The xmpMetadata to set.java.io.IOException
public XmpWriter getXmpWriter()
public void createXmpMetadata()
protected PdfIsoConformance initPdfIsoConformance()
public void setPDFXConformance(int pdfx)
PdfXConformance.setPDFXConformance(int)
public int getPDFXConformance()
PdfXConformance.getPDFXConformance()
public boolean isPdfX()
PdfXConformance.isPdfX()
public boolean isPdfIso()
true
if the PDF has to be in conformance with any of the PDF ISO specificationspublic 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
outputConditionIdentifier
- a valueoutputCondition
- a valueregistryName
- a valueinfo
- a valuecolorProfile
- a valuejava.io.IOException
- on errorpublic void setOutputIntents(java.lang.String outputConditionIdentifier, java.lang.String outputCondition, java.lang.String registryName, java.lang.String info, byte[] destOutputProfile) throws java.io.IOException
ICC_Profile
-based version of this method.outputConditionIdentifier
- a valueoutputCondition
- a value, "PDFA/A" to force GTS_PDFA1, otherwise cued by pdfxConformance.registryName
- a valueinfo
- a valuedestOutputProfile
- a valuejava.io.IOException
public boolean setOutputIntents(PdfReader reader, boolean checkExistence) throws java.io.IOException
reader
- the other documentcheckExistence
- true
to just check for the existence of a valid output intent
dictionary, false
to insert the dictionary if it existstrue
if the output intent dictionary exists, false
otherwisejava.io.IOException
- on errorprotected static java.lang.String getNameString(PdfDictionary dic, PdfName key)
public void setEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, int encryptionType) throws DocumentException
setEncryption
in interface PdfEncryptionSettings
userPassword
- the user password. Can be null or emptyownerPassword
- the owner password. Can be null or emptypermissions
- the user permissionsencryptionType
- can be any of the following: PdfWriter#STANDARD_ENCRYPTION_40, PdfWriter#STANDARD_ENCRYPTION_128, PdfWriter#ENCRYPTION_AES_128 or PdfWriter#ENCRYPTION_AES_256DocumentException
- if the document is already openpublic void setEncryption(java.security.cert.Certificate[] certs, int[] permissions, int encryptionType) throws DocumentException
setEncryption
in interface PdfEncryptionSettings
certs
- Certificates to encrypt the documentpermissions
- the user permissionsencryptionType
- can be any of the following: PdfWriter#STANDARD_ENCRYPTION_40, PdfWriter#STANDARD_ENCRYPTION_128, PdfWriter#ENCRYPTION_AES_128 or PdfWriter#ENCRYPTION_AES_256DocumentException
- if the document is already open@Deprecated public void setEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, boolean strength128Bits) throws DocumentException
userPassword
- the user password. Can be null or emptyownerPassword
- the owner password. Can be null or emptypermissions
- the user permissionsstrength128Bits
- true
for 128 bit key length, false
for 40 bit key lengthDocumentException
- if the document is already open@Deprecated public void setEncryption(boolean strength, java.lang.String userPassword, java.lang.String ownerPassword, int permissions) throws DocumentException
strength
- true
for 128 bit key length, false
for 40 bit key lengthuserPassword
- the user password. Can be null or emptyownerPassword
- the owner password. Can be null or emptypermissions
- the user permissionsDocumentException
- if the document is already open@Deprecated public void setEncryption(int encryptionType, java.lang.String userPassword, java.lang.String ownerPassword, int permissions) throws DocumentException
encryptionType
- the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128.
Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartextuserPassword
- the user password. Can be null or emptyownerPassword
- the owner password. Can be null or emptypermissions
- the user permissionsDocumentException
- if the document is already openpublic boolean isFullCompression()
public void setFullCompression() throws DocumentException
DocumentException
public int getCompressionLevel()
public void setCompressionLevel(int compressionLevel)
compressionLevel
- a value between 0 (best speed) and 9 (best compression)public void releaseTemplate(PdfTemplate tp) throws java.io.IOException
tp
- the template to releasejava.io.IOException
- on errorpublic PdfImportedPage getImportedPage(PdfReader reader, int pageNumber)
reader
- the PDF document where the page ispageNumber
- the page number. The first page is 1protected com.itextpdf.text.pdf.PdfReaderInstance getPdfReaderInstance(PdfReader reader)
reader
- the PDF reader that you want an instance forpublic void freeReader(PdfReader reader) throws java.io.IOException
reader
- the PdfReader
to freejava.io.IOException
- on errorpublic long getCurrentDocumentSize()
freeReader()
when concatenating many documents and an idea of
the current size is needed.protected int getNewObjectNumber(PdfReader reader, int number, int generation)
public void setTagged()
public void setTagged(int taggingMode)
public boolean needToBeMarkedInContent(IAccessibleElement element)
public void checkElementRole(IAccessibleElement element, IAccessibleElement parent)
public boolean isTagged()
true
if the document is marked for taggingprotected void flushTaggedObjects() throws java.io.IOException
java.io.IOException
protected void flushAcroFields() throws java.io.IOException, BadPdfFormatException
java.io.IOException
BadPdfFormatException
public PdfStructureTreeRoot getStructureTreeRoot()
null
.public PdfOCProperties getOCProperties()
public void addOCGRadioGroup(java.util.ArrayList<PdfLayer> group)
group
- the radio grouppublic void lockLayer(PdfLayer layer)
layer
- the layer that needs to be added to the array of locked OCGsprotected void fillOCProperties(boolean erase)
erase
- true to erase the PdfName.OCGS
and PdfName.D
from the OCProperties first.public Rectangle getPageSize()
public void setCropBoxSize(Rectangle crop)
crop
- the crop boxpublic void setBoxSize(java.lang.String boxName, Rectangle size)
boxName
- the box sizesize
- the sizepublic Rectangle getBoxSize(java.lang.String boxName)
boxName
- crop, trim, art or bleedpublic Rectangle getBoxSize(java.lang.String boxName, Rectangle intersectingRectangle)
boxName
- crop, trim, art, bleedintersectingRectangle
- the rectangle that intersects the rectangle associated to the boxNamepublic void setPageEmpty(boolean pageEmpty)
pageEmpty
- the statepublic boolean isPageEmpty()
public void setPageAction(PdfName actionType, PdfAction action) throws DocumentException
PdfPageActions
setPageAction
in interface PdfPageActions
actionType
- the action type. It can be PdfWriter.PAGE_OPEN
or PdfWriter.PAGE_CLOSE
action
- the action to performDocumentException
- if the action type is invalidPdfPageActions.setPageAction(com.itextpdf.text.pdf.PdfName, com.itextpdf.text.pdf.PdfAction)
public void setDuration(int seconds)
PdfPageActions
setDuration
in interface PdfPageActions
seconds
- the number of seconds to display the pagePdfPageActions.setDuration(int)
public void setTransition(PdfTransition transition)
PdfPageActions
setTransition
in interface PdfPageActions
transition
- the Transition objectPdfPageActions.setTransition(com.itextpdf.text.pdf.PdfTransition)
public void setThumbnail(Image image) throws PdfException, DocumentException
image
- the imagePdfException
- on errorDocumentException
- or errorpublic PdfDictionary getGroup()
public void setGroup(PdfDictionary group)
group
- New value of property group.public float getSpaceCharRatio()
public void setSpaceCharRatio(float spaceCharRatio)
spaceCharRatio
times more
than extra character spacing. If the ratio is PdfWriter.NO_SPACE_CHAR_RATIO
then the extra character spacing will be zero.spaceCharRatio
- the ratio between the extra word spacing and the extra character spacingpublic void setRunDirection(int runDirection)
setRunDirection
in interface PdfRunDirection
runDirection
- the run directionpublic int getRunDirection()
getRunDirection
in interface PdfRunDirection
public void setUserunit(float userunit) throws DocumentException
userunit
- The userunit to set.DocumentException
- on errorpublic PdfDictionary getDefaultColorspace()
public void setDefaultColorspace(PdfName key, PdfObject cs)
The colorspace is applied immediately when creating templates and at the page end for the main document content.
key
- the name of the colorspace. It can be PdfName.DEFAULTGRAY
, PdfName.DEFAULTRGB
or PdfName.DEFAULTCMYK
cs
- the colorspace. A null
or PdfNull
removes any colorspace with the same namepublic boolean isStrictImageSequence()
public void setStrictImageSequence(boolean strictImageSequence)
strictImageSequence
- new value of property strictImageSequencepublic void clearTextWrap() throws DocumentException
DocumentException
public PdfName addDirectImageSimple(Image image) throws PdfException, DocumentException
Document.add(Image)
.
Use this method only if you know what you're doing!image
- the Image
to addPdfException
- on errorDocumentException
- on errorpublic PdfName addDirectImageSimple(Image image, PdfIndirectReference fixedRef) throws PdfException, DocumentException
Document.add(Image)
.
Use this method only if you know what you're doing!image
- the Image
to addfixedRef
- the reference to used. It may be null
,
a PdfIndirectReference
or a PRIndirectReference
.PdfException
- on errorDocumentException
- on errorprotected PdfIndirectReference add(PdfICCBased icc)
protected PdfIndirectReference getReferenceJBIG2Globals(byte[] content)
content
- a byte array that may already been added to the writer inside a stream object.public boolean isUserProperties()
public void setUserProperties(boolean userProperties)
userProperties
- the user properties flagpublic boolean isRgbTransparencyBlending()
true
if the transparency blending colorspace is RGB, false
if it is the default blending colorspacepublic void setRgbTransparencyBlending(boolean rgbTransparencyBlending)
rgbTransparencyBlending
- true
to set the transparency blending colorspace to RGB, false
to use the default blending colorspaceprotected static void writeKeyInfo(java.io.OutputStream os) throws java.io.IOException
java.io.IOException
protected TtfUnicodeWriter getTtfUnicodeWriter()
protected XmpWriter createXmpWriter(java.io.ByteArrayOutputStream baos, PdfDictionary info) throws java.io.IOException
java.io.IOException
protected XmpWriter createXmpWriter(java.io.ByteArrayOutputStream baos, java.util.HashMap<java.lang.String,java.lang.String> info) throws java.io.IOException
java.io.IOException
public PdfAnnotation createAnnotation(Rectangle rect, PdfName subtype)
rect
- subtype
- public PdfAnnotation createAnnotation(float llx, float lly, float urx, float ury, PdfString title, PdfString content, PdfName subtype)
llx
- lly
- urx
- ury
- title
- content
- subtype
- public PdfAnnotation createAnnotation(float llx, float lly, float urx, float ury, PdfAction action, PdfName subtype)
llx
- lly
- urx
- ury
- action
- subtype
- public static void checkPdfIsoConformance(PdfWriter writer, int key, java.lang.Object obj1)
public void checkPdfIsoConformance(int key, java.lang.Object obj1)
public java.util.List<PdfName> getStandardStructElems()
public void useExternalCacheForTagStructure(TempFileCache fileCache)
Copyright © 1998–2018. All rights reserved.