com.lowagie.text.pdf
public class PdfWriter extends DocWriter implements PdfViewerPreferences, PdfEncryptionSettings, PdfVersion, PdfDocumentActions, PdfPageActions, PdfXConformance, 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.
Nested Class Summary | |
---|---|
static class | PdfWriter.PdfBody
This class generates the structure of a PDF document.
|
static class | PdfWriter.PdfTrailerPdfTrailer is the PDF Trailer object.
|
Field Summary | |
---|---|
static int | AllowAssembly |
static int | AllowCopy |
static int | AllowDegradedPrinting |
static int | AllowFillIn |
static int | AllowModifyAnnotations |
static int | AllowModifyContents |
static int | AllowPrinting |
static int | AllowScreenReaders |
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
|
protected PdfWriter.PdfBody | body body of the PDF document |
protected int | colorNumber The color number counter for the colors in the document. |
protected int | compressionLevel
The compression level of the content streams. |
protected PdfEncryption | crypto Contains the business logic for cryptography. |
protected int | currentPageNumber The current page number. |
protected PdfReaderInstance | currentPdfReaderInstance |
static int | CenterWindow A viewer preference |
protected PdfDictionary | defaultColorspace |
protected PdfContentByte | directContent The direct content in this document. |
protected PdfContentByte | directContentUnder The direct content under in this document. |
protected HashMap | documentColors The colors of this document |
protected HashMap | documentExtGState |
protected HashMap | documentFonts The fonts of this document |
protected HashSet | documentOCG A hashSet containing all the PdfLayer objects. |
protected ArrayList | documentOCGorder An array list used to define the order of an OCG tree. |
protected HashMap | documentPatterns The patterns of this document |
protected HashMap | documentProperties |
protected HashMap | documentShadingPatterns |
protected HashMap | documentShadings |
protected HashMap | documentSpotPatterns |
static int | DirectionL2R A viewer preference |
static int | DirectionR2L A viewer preference |
static int | DisplayDocTitle A viewer preference |
static PdfName | DID_PRINT action value |
static PdfName | DID_SAVE action value |
static PdfName | DOCUMENT_CLOSE action value |
static int | DO_NOT_ENCRYPT_METADATA Add this to the mode to keep the metadata in clear text |
protected PdfDictionary | extraCatalog Holds value of property extraCatalog this is used for Output Intents. |
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_MASK Mask to separate the encryption type from the encryption mode. |
protected int | fontNumber The font number counter for the fonts in the document. |
protected HashMap | 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 | FitWindow A viewer preference |
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 |
HashMap | images This is the list with all the images in the document. |
protected HashMap | importedPages |
protected List | newBookmarks |
static int | NonFullScreenPageModeUseNone A viewer preference |
static int | NonFullScreenPageModeUseOC A viewer preference |
static int | NonFullScreenPageModeUseOutlines A viewer preference |
static int | NonFullScreenPageModeUseThumbs A viewer preference |
static float | NO_SPACE_CHAR_RATIO Disable the inter-character spacing. |
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. |
PdfPageEvent | pageEvent The PdfPageEvent for this document. |
protected ArrayList | pageReferences The PdfIndirectReference to the pages. |
protected ColorDetails | patternColorspaceCMYK |
protected ColorDetails | patternColorspaceGRAY |
protected ColorDetails | patternColorspaceRGB |
protected int | patternNumber The pattern number counter for the colors in the document. |
protected PdfDocument | pdf the pdfdocument object. |
PdfXConformanceImp | pdfxConformance Stores the PDF/X level. |
protected PdfVersionImp | pdf_version Stores the version information for the header and the catalog. |
protected int | prevxref A number referring to the previous Cross-Reference Table. |
static PdfName | PAGE_CLOSE action value |
static PdfName | PAGE_OPEN action value |
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 |
static int | PDFA1A PDFA-1A level. |
static int | PDFA1B PDFA-1B level. |
static int | PDFX1A2001 A PDF/X level. |
static int | PDFX32002 A PDF/X level. |
static int | PDFXNONE A PDF/X level. |
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) |
static int | PrintScalingNone A viewer preference |
boolean | rgbTransparencyBlending
Holds value of property RGBTranparency. |
protected PdfPages | root The root of the page tree. |
protected int | runDirection |
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. |
float | spaceCharRatio
The ratio between the extra word spacing and the extra character spacing.
|
protected PdfStructureTreeRoot | structureTreeRoot |
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 |
static boolean | STRENGTH40BITS |
protected boolean | tagged |
boolean | userProperties
A flag indicating the presence of structure elements that contain user properties attributes. |
protected float | userunit |
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. |
Constructor Summary | |
---|---|
protected | PdfWriter()
Constructs a PdfWriter . |
protected | PdfWriter(PdfDocument document, OutputStream os)
Constructs a PdfWriter .
|
Method Summary | |
---|---|
PdfIndirectReference | add(PdfPage page, PdfContents contents)
Adds some PdfContents to this Writer.
|
PdfIndirectReference | add(PdfImage pdfImage, PdfIndirectReference fixedRef)
Writes a PdfImage to the outputstream.
|
protected PdfIndirectReference | add(PdfICCBased icc) |
void | addAnnotation(PdfAnnotation annot) |
void | addAnnotation(PdfAnnotation annot, int page) |
void | addASEvent(PdfName event, PdfName category) |
void | addCalculationOrder(PdfFormField annot) |
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.
|
PdfName | addDirectTemplateSimple(PdfTemplate template, PdfName forcedName)
Adds a template to the document but not to the page resources. |
void | addFileAttachment(String description, byte[] fileStore, String file, String fileDisplay)
Use this method to add a file attachment at the document level. |
void | addFileAttachment(String description, PdfFileSpecification fs)
Use this method to add a file attachment at the document level. |
void | addFileAttachment(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(String code, boolean unicode)
Use this method to add a JavaScript action at the document level.
|
void | addJavaScript(String code)
Use this method to adds a JavaScript action at the document level.
|
void | addJavaScript(String name, PdfAction js)
Use this method to add a JavaScript action at the document level.
|
void | addJavaScript(String name, String code, boolean unicode)
Use this method to add a JavaScript action at the document level.
|
void | addJavaScript(String name, String code)
Use this method to adds a JavaScript action at the document level.
|
void | addLocalDestinations(TreeMap dest)
Adds the local destinations to the body of the document. |
void | addOCGRadioGroup(ArrayList group)
Use this method to set a collection of optional content groups
whose states are intended to follow a "radio button" paradigm.
|
protected void | addSharedObjectsToBody() |
FontDetails | addSimple(BaseFont bf)
Adds a BaseFont to the document but not to the page resources.
|
ColorDetails | addSimple(PdfSpotColor spc)
Adds a SpotColor to the document but not to the page resources. |
PdfObject[] | addSimpleExtGState(PdfDictionary gstate) |
PdfName | addSimplePattern(PdfPatternPainter painter) |
ColorDetails | addSimplePatternColorspace(Color color) |
PdfObject[] | addSimpleProperty(Object prop, PdfIndirectReference refi) |
void | addSimpleShading(PdfShading shading) |
void | addSimpleShadingPattern(PdfShadingPattern shading) |
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, 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.
|
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.
|
void | addViewerPreference(PdfName key, PdfObject value) |
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.
|
void | createXmpMetadata()
Use this method to creates XMP Metadata based
on the metadata in the PdfDocument. |
byte[] | createXmpMetadataBytes() |
void | eliminateFontSubset(PdfDictionary fonts) |
protected void | fillOCProperties(boolean erase) |
boolean | fitsPage(Table table, float margin)
Checks if a Table fits the current page of the PdfDocument .
|
boolean | fitsPage(Table table)
Checks if a Table fits the current page of the PdfDocument .
|
void | freeReader(PdfReader reader)
Use this method to writes the reader to the document
and free the memory used by it.
|
PdfAcroForm | getAcroForm() |
Rectangle | getBoxSize(String boxName)
Use this method to get the size of a trim, art, crop or bleed box,
or null if not defined. |
protected PdfDictionary | getCatalog(PdfIndirectReference rootObj) |
PdfName | getColorspaceName() |
int | getCompressionLevel()
Returns the compression level used for streams written by this writer. |
int | getCurrentDocumentSize()
Use this method to gets the current document size.
|
PdfIndirectReference | getCurrentPage() |
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.
|
PdfEncryption | getEncryption() |
PdfDictionary | getExtraCatalog()
Sets extra keys to the catalog. |
PdfDictionary | getGroup()
Use this method to get the group dictionary. |
PdfIndirectReference | getImageReference(PdfName name)
return the PdfIndirectReference to the image with a given name.
|
PdfImportedPage | getImportedPage(PdfReader reader, int pageNumber)
Use this method to get a page from other PDF document.
|
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, OutputStream os)
Use this method to get an instance of the PdfWriter .
|
static PdfWriter | getInstance(Document document, OutputStream os, DocListener listener)
Use this method to get an instance of the PdfWriter .
|
static String | getNameString(PdfDictionary dic, PdfName key) |
protected int | getNewObjectNumber(PdfReader reader, int number, int generation) |
static void | getOCGOrder(PdfArray order, PdfLayer layer) |
PdfOCProperties | getOCProperties()
Use this method to get the Optional Content Properties Dictionary.
|
OutputStreamCounter | getOs()
Returns the outputStreamCounter. |
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. |
PdfDocument | getPdfDocument()
Gets the PdfDocument associated with this writer. |
PdfIndirectReference | getPdfIndirectReference()
Use this to get an PdfIndirectReference for an object that
will be created in the future.
|
PdfVersionImp | getPdfVersion()
Returns the version information. |
int | getPDFXConformance() |
RandomAccessFileOrArray | getReaderFile(PdfReader reader) |
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. |
PdfStructureTreeRoot | getStructureTreeRoot()
Gets the structure tree root. |
float | getUserunit()
Use this method to get the user unit.
|
float | getVerticalPosition(boolean ensureNewLine)
Use this method to get the current vertical page position. |
boolean | isFullCompression()
Use this method to find out if 1.5 compression is on. |
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.
|
void | open()
Signals that the Document has been opened and that
Elements can be added.
|
boolean | propertyExists(Object prop) |
void | registerLayer(PdfOCG layer) |
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 | resetContent()
Resets all the direct contents to empty.
|
void | setAdditionalAction(PdfName actionType, PdfAction action) |
void | setAtLeastPdfVersion(char version) |
void | setBoxSize(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) |
void | setEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, int encryptionType) |
void | setEncryption(Certificate[] certs, int[] permissions, int encryptionType) |
void | setEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, boolean strength128Bits)
Sets the encryption options for this document. |
void | setEncryption(boolean strength, String userPassword, String ownerPassword, int permissions)
Sets the encryption options for this document. |
void | setEncryption(int encryptionType, String userPassword, String ownerPassword, int permissions)
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 | setLinearPageMode()
Use this method to make sure the page tree has a linear structure
(every leave is attached directly to the root).
|
void | setOpenAction(String name) |
void | setOpenAction(PdfAction action) |
void | setOutlines(List outlines)
Sets the bookmarks. |
void | setOutputIntents(String outputConditionIdentifier, String outputCondition, String registryName, String info, byte[] destOutputProfile)
Use this method to set the values of the output intent dictionary.
|
boolean | setOutputIntents(PdfReader reader, boolean checkExistence)
Use this method to copy the output intent dictionary
from another document to this one. |
void | setPageAction(PdfName actionType, PdfAction 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 | setPageXmpMetadata(byte[] xmpMetadata)
Use this method to set the XMP Metadata for each page. |
void | setPdfVersion(char version) |
void | setPdfVersion(PdfName version) |
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) |
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 | setTagged()
Mark this document for tagging. |
void | setThumbnail(Image image)
Use this method to set the thumbnail image for the current page. |
void | setTransition(PdfTransition transition) |
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) |
void | setXmpMetadata(byte[] xmpMetadata)
Use this method to set the XMP Metadata. |
protected void | writeOutlines(PdfDictionary catalog, boolean namedAsNames) |
Deprecated: As of iText 2.0.7, use ALLOW_ASSEMBLY instead. Scheduled for removal at or after 2.2.0
Deprecated: As of iText 2.0.7, use ALLOW_COPY instead. Scheduled for removal at or after 2.2.0
Deprecated: As of iText 2.0.7, use ALLOW_DEGRADED_PRINTING instead. Scheduled for removal at or after 2.2.0
Deprecated: As of iText 2.0.7, use ALLOW_FILL_IN instead. Scheduled for removal at or after 2.2.0
Deprecated: As of iText 2.0.7, use ALLOW_MODIFY_ANNOTATIONS instead. Scheduled for removal at or after 2.2.0
Deprecated: As of iText 2.0.7, use ALLOW_MODIFY_CONTENTS instead. Scheduled for removal at or after 2.2.0
Deprecated: As of iText 2.0.7, use ALLOW_PRINTING instead. Scheduled for removal at or after 2.2.0
Deprecated: As of iText 2.0.7, use ALLOW_SCREENREADERS instead. Scheduled for removal at or after 2.2.0
Since: 2.0.7
Since: 2.0.7
Since: 2.0.7
Since: 2.0.7
Since: 2.0.7
Since: 2.0.7
Since: 2.0.7
Since: 2.0.7
Since: 2.1.3
Since: 2.1.3
Since: 2.1.2
PdfPageEvent
for this document.ratio
times more than extra character spacing.Deprecated: As of iText 2.0.7, use STANDARD_ENCRYPTION_128 instead. Scheduled for removal at or after 2.2.0
Deprecated: As of iText 2.0.7, use STANDARD_ENCRYPTION_40 instead. Scheduled for removal at or after 2.2.0
PdfWriter
.PdfWriter
.
Remark: a PdfWriter can only be constructed by calling the method
getInstance(Document document, OutputStream os)
.
Parameters: document The PdfDocument
that has to be written os The OutputStream
the writer has to write to.
PdfContents
to this Writer.
The document has to be open before you can begin to add content to the body of the document.
Parameters: page the PdfPage
to add contents the PdfContents
of the page
Returns: a PdfIndirectReference
Throws: PdfException on error
PdfImage
to the outputstream.
Parameters: pdfImage the image to be added
Returns: a PdfIndirectReference
to the encapsulated image
Throws: PdfException when a document isn't open yet, or has been closed
See Also: addAnnotation
See Also: addCalculationOrder
Document.add(Image)
.
Use this method only if you know what you're doing!Parameters: image the Image
to add
Returns: the name of the image added
Throws: PdfException on error DocumentException on error
Document.add(Image)
.
Use this method only if you know what you're doing!Parameters: image the Image
to add fixedRef the reference to used. It may be null
,
a PdfIndirectReference
or a PRIndirectReference
.
Returns: the name of the image added
Throws: PdfException on error DocumentException on error
Parameters: template the template to add forcedName the template name, rather than a generated one. Can be null
Returns: the PdfName
for this template
Parameters: description the file description fileStore an array with the file. If it's null
the file will be read from the disk file the path to the file. It will only be used if
fileStore
is not null
fileDisplay the actual file name stored in the pdf
Throws: IOException on error
Parameters: description the file description fs the file specification
Parameters: fs the file specification
Parameters: js The JavaScript action
Parameters: code the JavaScript code unicode select JavaScript unicode. Note that the internal Acrobat JavaScript engine does not support unicode, so this may or may not work for you
Parameters: code the JavaScript code
Parameters: name The name of the JS Action in the name tree js The JavaScript action
Parameters: name The name of the JS Action in the name tree code the JavaScript code unicode select JavaScript unicode. Note that the internal Acrobat JavaScript engine does not support unicode, so this may or may not work for you
Parameters: name The name of the JS Action in the name tree code the JavaScript code
Parameters: dest the HashMap
containing the destinations
Throws: IOException on error
Parameters: group the radio group
BaseFont
to the document but not to the page resources.
It is used for templates.Parameters: bf the BaseFont
to add
Returns: an Object[]
where position 0 is a PdfName
and position 1 is an PdfIndirectReference
SpotColor
to the document but not to the page resources.Parameters: spc the SpotColor
to add
Returns: an Object[]
where position 0 is a PdfName
and position 1 is an PdfIndirectReference
Parameters: object
Returns: a PdfIndirectObject
Throws: IOException
Parameters: object inObjStm
Returns: a PdfIndirectObject
Throws: IOException
Parameters: object ref
Returns: a PdfIndirectObject
Throws: IOException
Parameters: object ref inObjStm
Returns: a PdfIndirectObject
Throws: IOException
Parameters: object refNumber
Returns: a PdfIndirectObject
Throws: IOException
Parameters: object refNumber inObjStm
Returns: a PdfIndirectObject
Throws: IOException
See Also: PdfViewerPreferences
Throws: DocumentException
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.
See Also: close
Returns: an XmpMetadata byte array
Since: 2.1.2
Table
fits the current page of the PdfDocument
.
Parameters: table the table that has to be checked margin a certain margin
Returns: true
if the Table
fits the page, false
otherwise.
Table
fits the current page of the PdfDocument
.
Parameters: table the table that has to be checked
Returns: true
if the Table
fits the page, false
otherwise.
Parameters: reader the PdfReader
to free
Throws: IOException on error
See Also: getAcroForm
Parameters: boxName crop, trim, art or bleed
Returns: the compression level (0 = best speed, 9 = best compression, -1 is default)
Since: 2.1.3
freeReader()
when concatenating many documents and an idea of
the current size is needed.Returns: the approximate size without fonts or templates
Returns: the default colorspaces
Returns: the direct content
Returns: the direct content
Returns: the catalog to change
Returns: Value of property group.
PdfIndirectReference
to the image with a given name.
Parameters: name the name of the image
Returns: a PdfIndirectReference
Parameters: reader the PDF document where the page is pageNumber the page number. The first page is 1
Returns: the template representing the imported page
Returns: the info dictionary
PdfWriter
.
Parameters: document The Document
that has to be written os The OutputStream
the writer has to write to.
Returns: a new PdfWriter
Throws: DocumentException on error
PdfWriter
.
Parameters: document The Document
that has to be written os The OutputStream
the writer has to write to. listener A DocListener
to pass to the PdfDocument.
Returns: a new PdfWriter
Throws: DocumentException on error
Returns: the Optional Content Properties Dictionary
Returns: the outputStreamCounter
PdfPageEvent
for this document or null
if none is set.Returns: the PdfPageEvent
for this document or null
if none is set
Returns: a page number
Parameters: page the page number. The first page is 1
Returns: the reference to the page
Returns: a Rectangle
PdfDocument
associated with this writer.Returns: the PdfDocument
PdfIndirectReference
for an object that
will be created in the future.
Use this method only if you know what you're doing!Returns: the PdfIndirectReference
See Also: getPDFXConformance
Returns: the root outline
Returns: the run direction
Returns: the space/character extra spacing ratio
null
.Returns: the structure tree root
Returns: Returns the userunit.
Parameters: 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.
Returns: The current vertical page position.
Returns: the 1.5 compression status
See Also: isPdfX
Returns: true
if the transparency blending colorspace is RGB, false
if it is the default blending colorspace
Since: 2.1.0
Returns: value of property strictImageSequence
Returns: true
if the document is marked for tagging
Returns: the user properties flag
Parameters: layer the layer that needs to be added to the array of locked OCGs
Since: 2.1.2
Document
has been opened and that
Elements
can be added.
When this method is called, the PDF-document header is written to the outputstream.
See Also: open
Parameters: tp the template to release
Throws: IOException on error
null
argument value only returns the number of pages to process.
It is advisable to issue a Document.newPage()
before using this method.Parameters: order an array with the new page sequence. It must have the same size as the number of pages.
Returns: the total number of pages
Throws: DocumentException if all the pages are not present in the array
See Also: PdfDocumentActions
See Also: PdfVersion
Parameters: boxName the box size size the size
Parameters: collection a dictionary of type PdfCollection
Parameters: compressionLevel a value between 0 (best speed) and 9 (best compression)
Since: 2.1.3
Parameters: crop the crop box
The colorspace is applied immediately when creating templates and at the page end for the main document content.
Parameters: 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 name
See Also: PdfPageActions
See Also: (byte[], byte[], int, int)
Deprecated: As of iText 2.0.3, replaced by (@link #setEncryption(byte[], byte[], int, int)}. Scheduled for removal at or after 2.2.0
Sets the encryption options for this document. The userPassword and the ownerPassword can be null or have zero length. In this case the ownerPassword is replaced by a random string. The open permissions for the document can be AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. The permissions can be combined by ORing them.Parameters: userPassword the user password. Can be null or empty ownerPassword the owner password. Can be null or empty permissions the user permissions strength128Bits true
for 128 bit key length, false
for 40 bit key length
Throws: DocumentException if the document is already open
Deprecated: As of iText 2.0.3, replaced by (@link #setEncryption(byte[], byte[], int, int)}. Scheduled for removal at or after 2.2.0
Sets the encryption options for this document. The userPassword and the ownerPassword can be null or have zero length. In this case the ownerPassword is replaced by a random string. The open permissions for the document can be AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. The permissions can be combined by ORing them.Parameters: strength true
for 128 bit key length, false
for 40 bit key length userPassword the user password. Can be null or empty ownerPassword the owner password. Can be null or empty permissions the user permissions
Throws: DocumentException if the document is already open
Deprecated: As of iText 2.0.3, replaced by (@link #setEncryption(byte[], byte[], int, int)}. Scheduled for removal at or after 2.2.0
Sets the encryption options for this document. The userPassword and the ownerPassword can be null or have zero length. In this case the ownerPassword is replaced by a random string. The open permissions for the document can be AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. The permissions can be combined by ORing them.Parameters: 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 cleartext userPassword the user password. Can be null or empty ownerPassword the owner password. Can be null or empty permissions the user permissions
Throws: DocumentException if the document is already open
If set before opening the document it will also set the pdf version to 1.5.
Parameters: group New value of property group.
See Also: PdfDocumentActions
See Also: setOpenAction
Parameters: outlines the bookmarks or null
to remove any
Parameters: outputConditionIdentifier a value outputCondition a value registryName a value info a value destOutputProfile a value
Throws: IOException on error
Parameters: reader the other document checkExistence true
to just check for the existence of a valid output intent
dictionary, false
to insert the dictionary if it exists
Returns: true
if the output intent dictionary exists, false
otherwise
Throws: IOException on error
See Also: PdfPageActions
Parameters: pageEmpty the state
PdfPageEvent
for this document.Parameters: event the PdfPageEvent
for this document
Parameters: pageLabels the page labels
Parameters: xmpMetadata The xmpMetadata to set.
See Also: PdfVersion
See Also: setPdfVersion
See Also: PdfXConformance
Parameters: rgbTransparencyBlending true
to set the transparency blending colorspace to RGB, false
to use the default blending colorspace
Since: 2.1.0
Parameters: runDirection the run direction
See Also: PdfAnnotations
spaceCharRatio
times more
than extra character spacing. If the ratio is PdfWriter.NO_SPACE_CHAR_RATIO
then the extra character spacing will be zero.Parameters: spaceCharRatio the ratio between the extra word spacing and the extra character spacing
Parameters: strictImageSequence new value of property strictImageSequence
Parameters: image the image
Throws: PdfException on error DocumentException or error
See Also: setTransition
Parameters: userProperties the user properties flag
Parameters: userunit The userunit to set.
Throws: DocumentException on error
See Also: PdfViewerPreferences
Parameters: xmpMetadata The xmpMetadata to set.