|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.lowagie.text.DocWriter
com.lowagie.text.pdf.PdfWriter
public class PdfWriter
A 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. |
(package private) static class |
PdfWriter.PdfTrailer
PdfTrailer is the PDF Trailer object. |
| Field Summary | |
|---|---|
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 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
|
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 |
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 |
EMBEDDED_FILES_ONLY
Add this to the mode to keep encrypt only the embedded files. |
static int |
ENCRYPTION_AES_128
Type of encryption |
(package private) static int |
ENCRYPTION_MASK
Mask to separate the encryption type from the encryption mode. |
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 |
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. |
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 |
private HashMap |
images
This is the list with all the images in the document. |
protected HashMap |
importedPages
|
protected List |
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. |
static PdfName |
PAGE_CLOSE
action value |
static PdfName |
PAGE_OPEN
action value |
private PdfPageEvent |
pageEvent
The PdfPageEvent for this document. |
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 |
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. |
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) |
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. |
private PdfXConformanceImp |
pdfxConformance
Stores the PDF/X level. |
static int |
PDFXNONE
A PDF/X level. |
protected int |
prevxref
A number referring to the previous Cross-Reference Table. |
static int |
PrintScalingNone
A viewer preference |
private boolean |
rgbTransparencyBlending
Holds value of property RGBTranparency. |
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. |
private float |
spaceCharRatio
The ratio between the extra word spacing and the extra character spacing. |
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 boolean |
tagged
|
private 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. |
| Fields inherited from class com.lowagie.text.DocWriter |
|---|
closeStream, document, EQUALS, FORWARD, GT, LT, NEWLINE, open, os, pageSize, pause, QUOTE, SPACE, TAB |
| Constructor Summary | |
|---|---|
protected |
PdfWriter()
Constructs a PdfWriter. |
protected |
PdfWriter(PdfDocument document,
OutputStream os)
Constructs a PdfWriter. |
| Method Summary | |
|---|---|
protected PdfIndirectReference |
add(PdfICCBased icc)
|
(package private) PdfIndirectReference |
add(PdfImage pdfImage,
PdfIndirectReference fixedRef)
Writes a PdfImage to the outputstream. |
(package private) PdfIndirectReference |
add(PdfPage page,
PdfContents contents)
Adds some PdfContents to this Writer. |
void |
addAnnotation(PdfAnnotation annot)
Use this methods to add a PdfAnnotation or a PdfFormField
to the document. |
(package private) void |
addAnnotation(PdfAnnotation annot,
int page)
|
private void |
addASEvent(PdfName event,
PdfName category)
|
void |
addCalculationOrder(PdfFormField annot)
Use this method to adds the PdfAnnotation
to the calculation order array. |
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. |
(package private) PdfName |
addDirectTemplateSimple(PdfTemplate template,
PdfName forcedName)
Adds a template 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. |
(package private) 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()
|
(package private) FontDetails |
addSimple(BaseFont bf)
Adds a BaseFont to the document but not to the page resources. |
(package private) ColorDetails |
addSimple(PdfSpotColor spc)
Adds a SpotColor to the document but not to the page resources. |
(package private) PdfObject[] |
addSimpleExtGState(PdfDictionary gstate)
|
(package private) PdfName |
addSimplePattern(PdfPatternPainter painter)
|
(package private) ColorDetails |
addSimplePatternColorspace(Color color)
|
(package private) PdfObject[] |
addSimpleProperty(Object prop,
PdfIndirectReference refi)
|
(package private) void |
addSimpleShading(PdfShading shading)
|
(package private) 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,
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. |
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. |
private byte[] |
createXmpMetadataBytes()
|
(package private) void |
eliminateFontSubset(PdfDictionary fonts)
|
protected void |
fillOCProperties(boolean erase)
|
boolean |
fitsPage(Table table)
Checks if a Table fits the current page of the PdfDocument. |
boolean |
fitsPage(Table table,
float margin)
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()
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. |
protected PdfDictionary |
getCatalog(PdfIndirectReference rootObj)
|
(package private) 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. |
(package private) 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. |
(package private) PdfEncryption |
getEncryption()
|
PdfDictionary |
getExtraCatalog()
Sets extra keys to the catalog. |
PdfDictionary |
getGroup()
Use this method to get the group dictionary. |
(package private) 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. |
(package private) 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. |
private static String |
getNameString(PdfDictionary dic,
PdfName key)
|
protected int |
getNewObjectNumber(PdfReader reader,
int number,
int generation)
|
private static void |
getOCGOrder(PdfArray order,
PdfLayer layer)
|
PdfOCProperties |
getOCProperties()
Use this method to get the Optional Content Properties Dictionary. |
(package private) 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. |
(package private) 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. |
(package private) PdfVersionImp |
getPdfVersion()
Returns the version information. |
int |
getPDFXConformance()
Getter for the PDF/X Conformance value. |
(package private) 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()
Checks if the PDF/X Conformance is necessary. |
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. |
(package private) boolean |
propertyExists(Object prop)
|
(package private) 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. |
(package private) void |
resetContent()
Resets all the direct contents to empty. |
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&nb |