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 and 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 and 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. Scheduled for removal at or after 2.2.0
|
static int |
AllowCopy
Deprecated.
As of iText 2.0.7, use
ALLOW_COPY instead. Scheduled for removal at or after 2.2.0
|
static int |
AllowDegradedPrinting
Deprecated.
As of iText 2.0.7, use
ALLOW_DEGRADED_PRINTING instead. Scheduled for removal at or after 2.2.0
|
static int |
AllowFillIn
Deprecated.
As of iText 2.0.7, use
ALLOW_FILL_IN instead. Scheduled for removal at or after 2.2.0
|
static int |
AllowModifyAnnotations
Deprecated.
As of iText 2.0.7, use
ALLOW_MODIFY_ANNOTATIONS instead. Scheduled for removal at or after 2.2.0
|
static int |
AllowModifyContents
Deprecated.
As of iText 2.0.7, use
ALLOW_MODIFY_CONTENTS instead. Scheduled for removal at or after 2.2.0
|
static int |
AllowPrinting
Deprecated.
As of iText 2.0.7, use
ALLOW_PRINTING instead. Scheduled for removal at or after 2.2.0
|
static int |
AllowScreenReaders
Deprecated.
As of iText 2.0.7, use
ALLOW_SCREENREADERS instead. Scheduled for removal at or after 2.2.0
|
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 HashMap<ICachedColorSpace,com.itextpdf.text.pdf.ColorDetails> |
documentColors
The colors of this document
|
protected HashMap<PdfDictionary,PdfObject[]> |
documentExtGState |
protected LinkedHashMap<BaseFont,com.itextpdf.text.pdf.FontDetails> |
documentFonts
The fonts of this document
|
protected LinkedHashSet<PdfOCG> |
documentOCG
A hashSet containing all the PdfLayer objects.
|
protected ArrayList<PdfOCG> |
documentOCGorder
An array list used to define the order of an OCG tree.
|
protected HashMap<PdfPatternPainter,PdfName> |
documentPatterns
The patterns of this document
|
protected HashMap<Object,PdfObject[]> |
documentProperties |
protected HashSet<PdfShadingPattern> |
documentShadingPatterns |
protected HashSet<PdfShading> |
documentShadings |
protected HashMap |
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 HashMap<PdfIndirectReference,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 HashMap<PdfStream,PdfIndirectReference> |
JBIG2Globals
A HashSet with Stream objects containing JBIG2 Globals
|
static int |
markAll |
static int |
markInlineElementsOnly |
protected List<HashMap<String,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 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 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. Scheduled for removal at or after 2.2.0
|
static boolean |
STRENGTH40BITS
Deprecated.
As of iText 2.0.7, use
STANDARD_ENCRYPTION_40 instead. Scheduled for removal at or after 2.2.0
|
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 and Description |
---|---|
protected |
PdfWriter()
Constructs a PdfWriter .
|
protected |
PdfWriter(PdfDocument document, OutputStream os)
Constructs a PdfWriter .
|
Modifier and Type | Method and 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(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 |
addJavaScript(PdfAction js)
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 code, boolean unicode)
Use this method to add 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)
Use this method to adds 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 |
addNamedDestination(String name, int page, PdfDestination dest)
Adds one named destination.
|
void |
addNamedDestinations(Map<String,String> map, int page_offset)
Adds named destinations in bulk.
|
void |
addOCGRadioGroup(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, Object obj1) |
static void |
checkPdfIsoConformance(PdfWriter writer, int key, 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(ByteArrayOutputStream baos, HashMap<String,String> info) |
protected XmpWriter |
createXmpWriter(ByteArrayOutputStream baos, PdfDictionary 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(String boxName)
Use this method to get the size of a trim, art, crop or bleed box, or null if not defined.
|
Rectangle |
getBoxSize(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, 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 .
|
protected static 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.
|
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(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, String userPassword, String ownerPassword, int permissions)
Deprecated.
As of iText 2.0.3, replaced by (@link #setEncryption(byte[], byte[], int, int)}. Scheduled for removal at or after 2.2.0
|
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)}. Scheduled for removal at or after 2.2.0
|
void |
setEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, int encryptionType)
Sets the encryption options for this document.
|
void |
setEncryption(Certificate[] certs, int[] permissions, int encryptionType)
Sets the encryption options for this document.
|
void |
setEncryption(int encryptionType, String userPassword, String ownerPassword, int permissions)
Deprecated.
As of iText 2.0.3, replaced by (@link #setEncryption(byte[], byte[], int, int)}. Scheduled for removal at or after 2.2.0
|
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(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(String name)
When the document opens it will jump to the destination with this name.
|
void |
setOutlines(List<HashMap<String,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(String outputConditionIdentifier, String outputCondition, String registryName, String info, byte[] destOutputProfile)
Sets the values of the output intent dictionary.
|
void |
setOutputIntents(String outputConditionIdentifier, String outputCondition, String registryName, 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(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 ArrayList<PdfIndirectReference> pageReferences
protected int currentPageNumber
protected PdfName tabs
protected PdfDictionary pageDictEntries
protected long prevxref
protected byte[] originalFileID
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.0
protected PdfEncryption crypto
protected boolean fullCompression
protected int compressionLevel
protected LinkedHashMap<BaseFont,com.itextpdf.text.pdf.FontDetails> documentFonts
protected int fontNumber
protected HashMap<PdfIndirectReference,Object[]> formXObjects
protected int formXObjectsCounter
protected HashMap<PdfReader,com.itextpdf.text.pdf.PdfReaderInstance> readerInstances
protected com.itextpdf.text.pdf.PdfReaderInstance currentPdfReaderInstance
protected HashMap<ICachedColorSpace,com.itextpdf.text.pdf.ColorDetails> documentColors
protected int colorNumber
protected HashMap<PdfPatternPainter,PdfName> documentPatterns
protected int patternNumber
protected HashSet<PdfShadingPattern> documentShadingPatterns
protected HashSet<PdfShading> documentShadings
protected HashMap<PdfDictionary,PdfObject[]> documentExtGState
public static final int markAll
public static final int markInlineElementsOnly
protected boolean tagged
protected int taggingMode
protected PdfStructureTreeRoot structureTreeRoot
protected LinkedHashSet<PdfOCG> documentOCG
protected 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 HashMapdocumentSpotPatterns
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 HashMap<PdfStream,PdfIndirectReference> JBIG2Globals
protected TtfUnicodeWriter ttfUnicodeWriter
protected PdfWriter()
PdfWriter
.
protected PdfWriter(PdfDocument document, 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 written
os
- The OutputStream
the writer has to write to.
protected Counter getCounter()
public static PdfWriter getInstance(Document document, OutputStream os) throws DocumentException
PdfWriter
.
document
- The Document
that has to be written
os
- The OutputStream
the writer has to write to.
PdfWriter
DocumentException
- on error
public static PdfWriter getInstance(Document document, OutputStream os, DocListener listener) throws DocumentException
PdfWriter
.
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.
PdfWriter
DocumentException
- on error
public 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 leading
DocumentException
- 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 IOException
object
-
IOException
public PdfIndirectObject addToBody(PdfObject object, boolean inObjStm) throws IOException
object
-
inObjStm
-
IOException
public PdfIndirectObject addToBody(PdfObject object, PdfIndirectReference ref) throws IOException
object
-
ref
-
IOException
public PdfIndirectObject addToBody(PdfObject object, PdfIndirectReference ref, boolean inObjStm) throws IOException
object
-
ref
-
inObjStm
-
IOException
public PdfIndirectObject addToBody(PdfObject object, int refNumber) throws IOException
object
-
refNumber
-
IOException
public PdfIndirectObject addToBody(PdfObject object, int refNumber, boolean inObjStm) throws IOException
object
-
refNumber
-
inObjStm
-
IOException
protected void cacheObject(PdfIndirectObject iobj)
iobj
- @see 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 key
object
- the PdfObject for the given key
public 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 array
public PdfIndirectReference getPageReference(int page)
page
- the page number. The first page is 1
public 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.W
public PdfName getTabs()
public void setPageEvent(PdfPageEvent event)
PdfPageEvent
for this document.
event
- the PdfPageEvent
for this document
public PdfPageEvent getPageEvent()
PdfPageEvent
for this document or null
if none is set.
PdfPageEvent
for this document or null
if none is set
public 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 IOException
IOException
protected void addSharedObjectsToBody() throws IOException
IOException
public PdfOutline getRootOutline()
public void setOutlines(List<HashMap<String,Object>> outlines)
SimpleBookmark
.
outlines
- the bookmarks or null
to remove any
protected void writeOutlines(PdfDictionary catalog, boolean namedAsNames) throws IOException
IOException
public void setPdfVersion(char version)
PdfVersion
setPdfVersion
in interface PdfVersion
version
- a character representing the PDF version
PdfVersion.setPdfVersion(char)
public void setAtLeastPdfVersion(char version)
PdfVersion
setAtLeastPdfVersion
in interface PdfVersion
version
- a character representing the PDF version
PdfVersion.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 catalog
PdfVersion.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 dictionary
PdfVersion.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 preferences
PdfViewerPreferences.setViewerPreferences(int)
public void addViewerPreference(PdfName key, PdfObject value)
PdfViewerPreferences
addViewerPreference
in interface PdfViewerPreferences
key
- the name of the viewer preference
value
- the value of the viewer preference
PdfViewerPreferences.addViewerPreference(com.itextpdf.text.pdf.PdfName, com.itextpdf.text.pdf.PdfObject)
public void setPageLabels(PdfPageLabels pageLabels)
pageLabels
- the page labels
public void addNamedDestinations(Map<String,String> map, int page_offset)
map
- a map with strings as keys for the names, and structured strings as values for the destinations
page_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(String name, int page, PdfDestination dest)
name
- the name for the destination
page
- the page number where you want to jump to
dest
- an explicit destination
public void addJavaScript(PdfAction js)
js
- The JavaScript action
public void addJavaScript(String code, boolean unicode)
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
public void addJavaScript(String code)
code
- the JavaScript code
public void addJavaScript(String name, PdfAction js)
name
- The name of the JS Action in the name tree
js
- The JavaScript action
public void addJavaScript(String name, String code, boolean unicode)
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
public void addJavaScript(String name, String code)
name
- The name of the JS Action in the name tree
code
- the JavaScript code
public void addFileAttachment(String description, byte[] fileStore, String file, String fileDisplay) throws IOException
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
IOException
- on error
public void addFileAttachment(String description, PdfFileSpecification fs) throws IOException
description
- the file description
fs
- the file specification
IOException
- if the file attachment could not be added to the document
public void addFileAttachment(PdfFileSpecification fs) throws IOException
fs
- the file specification
IOException
- if the file attachment could not be added to the document
public void setOpenAction(String name)
PdfDocumentActions
setOpenAction
in interface PdfDocumentActions
name
- the name of the destination to jump to
PdfDocumentActions.setOpenAction(java.lang.String)
public void setOpenAction(PdfAction action)
PdfDocumentActions
action
will be invoked.
setOpenAction
in interface PdfDocumentActions
action
- the action to be invoked
PdfDocumentActions.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 type
action
- the action to execute in response to the trigger
DocumentException
- on invalid action type
PdfDocumentActions.setAdditionalAction(com.itextpdf.text.pdf.PdfName, com.itextpdf.text.pdf.PdfAction)
public void setCollection(PdfCollection collection)
collection
- a dictionary of type PdfCollection
public 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 add
PdfAnnotations.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 added
PdfAnnotations.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 ones
PdfAnnotations.setSigFlags(int)
public void setLanguage(String language)
public void setXmpMetadata(byte[] xmpMetadata)
xmpMetadata
- The xmpMetadata to set.
public void setPageXmpMetadata(byte[] xmpMetadata) throws IOException
xmpMetadata
- The xmpMetadata to set.
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 specifications
public void setOutputIntents(String outputConditionIdentifier, String outputCondition, String registryName, String info, ICC_Profile colorProfile) throws IOException
outputConditionIdentifier
- a value
outputCondition
- a value
registryName
- a value
info
- a value
colorProfile
- a value
IOException
- on error
public void setOutputIntents(String outputConditionIdentifier, String outputCondition, String registryName, String info, byte[] destOutputProfile) throws IOException
ICC_Profile
-based version of this method.
outputConditionIdentifier
- a value
outputCondition
- a value, "PDFA/A" to force GTS_PDFA1, otherwise cued by pdfxConformance.
registryName
- a value
info
- a value
destOutputProfile
- a value
IOException
public boolean setOutputIntents(PdfReader reader, boolean checkExistence) throws IOException
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
true
if the output intent dictionary exists, false
otherwise
IOException
- on error
protected static 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 empty
ownerPassword
- the owner password. Can be null or empty
permissions
- the user permissions
encryptionType
- can be any of the following: PdfWriter#STANDARD_ENCRYPTION_40, PdfWriter#STANDARD_ENCRYPTION_128, PdfWriter#ENCRYPTION_AES_128 or PdfWriter#ENCRYPTION_AES_256
DocumentException
- if the document is already open
public void setEncryption(Certificate[] certs, int[] permissions, int encryptionType) throws DocumentException
setEncryption
in interface PdfEncryptionSettings
certs
- Certificates to encrypt the document
permissions
- the user permissions
encryptionType
- can be any of the following: PdfWriter#STANDARD_ENCRYPTION_40, PdfWriter#STANDARD_ENCRYPTION_128, PdfWriter#ENCRYPTION_AES_128 or PdfWriter#ENCRYPTION_AES_256
DocumentException
- 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 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
DocumentException
- if the document is already open
@Deprecated public void setEncryption(boolean strength, String userPassword, String ownerPassword, int permissions) throws DocumentException
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
DocumentException
- if the document is already open
@Deprecated public void setEncryption(int encryptionType, String userPassword, 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 cleartext
userPassword
- the user password. Can be null or empty
ownerPassword
- the owner password. Can be null or empty
permissions
- the user permissions
DocumentException
- if the document is already open
public 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 IOException
tp
- the template to release
IOException
- on error
public PdfImportedPage getImportedPage(PdfReader reader, int pageNumber)
reader
- the PDF document where the page is
pageNumber
- the page number. The first page is 1
protected com.itextpdf.text.pdf.PdfReaderInstance getPdfReaderInstance(PdfReader reader)
reader
- the PDF reader that you want an instance for
public void freeReader(PdfReader reader) throws IOException
reader
- the PdfReader
to free
IOException
- on error
public 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 tagging
protected void flushTaggedObjects() throws IOException
IOException
protected void flushAcroFields() throws IOException, BadPdfFormatException
IOException
BadPdfFormatException
public PdfStructureTreeRoot getStructureTreeRoot()
null
.
public PdfOCProperties getOCProperties()
public void addOCGRadioGroup(ArrayList<PdfLayer> group)
group
- the radio group
public void lockLayer(PdfLayer layer)
layer
- the layer that needs to be added to the array of locked OCGs
protected 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 box
public void setBoxSize(String boxName, Rectangle size)
boxName
- the box size
size
- the size
public Rectangle getBoxSize(String boxName)
boxName
- crop, trim, art or bleed
public Rectangle getBoxSize(String boxName, Rectangle intersectingRectangle)
boxName
- crop, trim, art, bleed
intersectingRectangle
- the rectangle that intersects the rectangle associated to the boxName
public void setPageEmpty(boolean pageEmpty)
pageEmpty
- the state
public 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 perform
DocumentException
- if the action type is invalid
PdfPageActions.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 page
PdfPageActions.setDuration(int)
public void setTransition(PdfTransition transition)
PdfPageActions
setTransition
in interface PdfPageActions
transition
- the Transition object
PdfPageActions.setTransition(com.itextpdf.text.pdf.PdfTransition)
public void setThumbnail(Image image) throws PdfException, DocumentException
image
- the image
PdfException
- on error
DocumentException
- or error
public 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 spacing
public void setRunDirection(int runDirection)
setRunDirection
in interface PdfRunDirection
runDirection
- the run direction
public int getRunDirection()
getRunDirection
in interface PdfRunDirection
public void setUserunit(float userunit) throws DocumentException
userunit
- The userunit to set.
DocumentException
- on error
public 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 name
public boolean isStrictImageSequence()
public void setStrictImageSequence(boolean strictImageSequence)
strictImageSequence
- new value of property strictImageSequence
public 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 add
PdfException
- on error
DocumentException
- on error
public 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 add
fixedRef
- the reference to used. It may be null
, a PdfIndirectReference
or a PRIndirectReference
.
PdfException
- on error
DocumentException
- on error
protected 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 flag
public boolean isRgbTransparencyBlending()
true
if the transparency blending colorspace is RGB, false
if it is the default blending colorspace
public void setRgbTransparencyBlending(boolean rgbTransparencyBlending)
rgbTransparencyBlending
- true
to set the transparency blending colorspace to RGB, false
to use the default blending colorspace
protected static void writeKeyInfo(OutputStream os) throws IOException
IOException
protected TtfUnicodeWriter getTtfUnicodeWriter()
protected XmpWriter createXmpWriter(ByteArrayOutputStream baos, PdfDictionary info) throws IOException
IOException
protected XmpWriter createXmpWriter(ByteArrayOutputStream baos, HashMap<String,String> info) throws IOException
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, Object obj1)
public void checkPdfIsoConformance(int key, Object obj1)
public List<PdfName> getStandardStructElems()
public void useExternalCacheForTagStructure(TempFileCache fileCache)
Copyright © 1998–2017. All rights reserved.