java.lang.Object
com.lowagie.text.Document
com.lowagie.text.pdf.PdfDocument
- All Implemented Interfaces:
DocListener,ElementListener,AutoCloseable,EventListener
Deprecated.
PdfDocument is the class that is used by PdfWriter
to translate a Document into a PDF with different pages.
A PdfDocument always listens to a Document and adds the Pdf representation of every
Element that is added to the Document.
- Since:
- 2.0.8 (class was package-private before)
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated.static classDeprecated.PdfInfois the PDF InfoDictionary.protected static classDeprecated.This is a helper class for adding a Table to a document. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected PdfDictionaryDeprecated.protected intDeprecated.This represents the current alignment of the PDF Elements.protected PdfActionDeprecated.The current activePdfActionwhen processing anAnchor.protected HashMap<String, PdfRectangle> Deprecated.This is the size of the several boxes that will be used in the next page.protected PdfCollectionDeprecated.protected floatDeprecated.This is the current height of the document.protected PdfOutlineDeprecated.This is the currentPdfOutlinein the hierarchy of outlines.protected HashMap<String, PdfIndirectReference> Deprecated.protected HashMap<String, PdfIndirectReference> Deprecated.protected intDeprecated.The duration of the pageprotected booleanDeprecated.Signals that OnOpenDocument should be called.protected PdfContentByteDeprecated.This is the PdfContentByte object, containing the borders and other Graphics.protected floatDeprecated.This is the position where the image ends.protected ImageDeprecated.This is the image that could not be shown on a previous page.protected PdfDocument.IndentationDeprecated.protected PdfDocument.PdfInfoDeprecated.some meta information about the Document.protected booleanDeprecated.Signals that onParagraph is valid (to avoid that a Chapter/Section title is treated as a Paragraph).protected intDeprecated.Holds the type of the last element, that has been added to the document.protected floatDeprecated.This represents the leading of the lines.protected intDeprecated.Signals that the current leading has to be subtracted from a YMark object when positive.protected PdfLineDeprecated.The line that is currently being written.Deprecated.The lines that are written until now.Deprecated.Stores the destinations keyed by name.protected intDeprecated.protected floatDeprecated.margin in y direction starting from the bottom.protected floatDeprecated.margin in x direction starting from the left.protected floatDeprecated.margin in x direction starting from the right.protected floatDeprecated.margin in y direction starting from the top.protected RectangleDeprecated.This is the size of the next page.protected PdfActionDeprecated.protected StringDeprecated.protected PdfDictionaryDeprecated.protected PdfPageLabelsDeprecated.protected com.lowagie.text.pdf.PageResourcesDeprecated.This are the page resources of the current Page.protected PdfOutlineDeprecated.This is the root outline of the document.protected static final DecimalFormatDeprecated.protected booleanDeprecated.Holds value of property strictImageSequence.protected PdfContentByteDeprecated.This is the PdfContentByte object, containing the text.protected intDeprecated.protected HashMap<String, PdfRectangle> Deprecated.This is the size of the several boxes of the current Page.protected PdfIndirectReferenceDeprecated.protected PdfTransitionDeprecated.The page transitionprotected PdfViewerPreferencesImpDeprecated.Contains the Viewer preferences of this PDF document.protected PdfWriterDeprecated.ThePdfWriter.protected byte[]Deprecated.XMP Metadata for the page.Fields inherited from class com.lowagie.text.Document
chapternumber, close, compress, footer, header, htmlStyleClass, javaScript_onLoad, javaScript_onUnLoad, marginBottom, marginLeft, marginMirroring, marginMirroringTopBottom, marginRight, marginTop, open, pageN, pageSize, plainRandomAccess, wmfFontCorrection -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanDeprecated.Signals that anElementwas added to theDocument.protected voidDeprecated.Adds an image to the document.protected voidDeprecated.Occupies space forImagethat will be added later instead of nowprotected voidaddSpacing(float extraspace, float oldleading, Font f) Deprecated.Adds extra space.voidDeprecated.Adds aPdfWriterto thePdfDocument.protected voidanalyzeRow(List<List<PdfCell>> rows, PdfDocument.RenderingContext ctx) Deprecated.protected voidDeprecated.If the current line is not empty or null, it is added to the arraylist of lines and a new empty line is added.voidDeprecated.Method added by Pelikan Stephanvoidclose()Deprecated.Closes the document.protected voidconsumeRowspan(List<PdfCell> row, PdfDocument.RenderingContext ctx) Deprecated.protected voiddelayTableAddition(PdfPTable table) Deprecated.Occupies space forPdfPTablethat will be added later instead of nowprotected voiddoFooter()Deprecated.protected voiddoHeader()Deprecated.protected voidDeprecated.Ensures that a new line has been started.extractRows(List<PdfCell> cells, PdfDocument.RenderingContext ctx) Deprecated.protected floatDeprecated.Writes all the lines to the text-object.protected voidDeprecated.write non-textElementinto documentprotected PdfDocument.PdfInfogetInfo()Deprecated.Gets thePdfInfo-object.floatDeprecated.Getter for the current leading.Deprecated.Gets the root outline.floatgetVerticalPosition(boolean ensureNewLine) Deprecated.Gets the current vertical page position.protected floatDeprecated.Gets the indentation on the left side.protected floatDeprecated.Gets the indentation on the right side.protected floatDeprecated.Gets the indentation on the top side.protected voidinitPage()Deprecated.Initializes a page.protected booleanmayBeRemoved(List<PdfCell> row) Deprecated.protected voidnewLine()Deprecated.Adds the current line to the list of lines and also adds an empty line.booleannewPage()Deprecated.Makes a new page and sends it to thePdfWriter.voidopen()Deprecated.Opens the document.protected voidrenderCells(PdfDocument.RenderingContext ctx, List cells, boolean hasToFit) Deprecated.voidDeprecated.Resets the footer of this document.voidDeprecated.Resets the header of this document.voidDeprecated.Sets the page number to 0.voidsetCollection(PdfCollection collection) Deprecated.Sets the collection dictionary.voidsetFooter(HeaderFooter footer) Deprecated.Changes the footer of this document.voidsetHeader(HeaderFooter header) Deprecated.Changes the header of this document.booleansetMarginMirroring(boolean MarginMirroring) Deprecated.Set the margin mirroring.booleansetMarginMirroringTopBottom(boolean MarginMirroringTopBottom) Deprecated.Set the margin mirroring.booleansetMargins(float marginLeft, float marginRight, float marginTop, float marginBottom) Deprecated.Sets the margins.protected voidDeprecated.voidsetPageCount(int pageN) Deprecated.Sets the page number.booleansetPageSize(Rectangle pageSize) Deprecated.Sets the pagesize.voidsetXmpMetadata(byte[] xmpMetadata) Deprecated.Use this method to set the XMP Metadata.Methods inherited from class com.lowagie.text.Document
addAuthor, addCreationDate, addCreationDate, addCreator, addDocListener, addHeader, addKeywords, addModificationDate, addModificationDate, addProducer, addProducer, addSubject, addTitle, bottom, bottom, bottomMargin, getDocumentLanguage, getHtmlStyleClass, getJavaScript_onLoad, getJavaScript_onUnLoad, getPageNumber, getPageSize, getProduct, getRelease, getTextRenderingOptions, getVersion, isGlyphSubstitutionEnabled, isMarginMirroring, isOpen, left, left, leftMargin, removeDocListener, right, right, rightMargin, setDocumentLanguage, setGlyphSubstitutionEnabled, setHtmlStyleClass, setJavaScript_onLoad, setJavaScript_onUnLoad, setTextRenderingOptions, top, top, topMargin
-
Field Details
-
SIXTEEN_DIGITS
Deprecated. -
writer
Deprecated.ThePdfWriter. -
text
Deprecated.This is the PdfContentByte object, containing the text. -
graphics
Deprecated.This is the PdfContentByte object, containing the borders and other Graphics. -
leading
protected float leadingDeprecated.This represents the leading of the lines. -
alignment
protected int alignmentDeprecated.This represents the current alignment of the PDF Elements. -
currentHeight
protected float currentHeightDeprecated.This is the current height of the document. -
isSectionTitle
protected boolean isSectionTitleDeprecated.Signals that onParagraph is valid (to avoid that a Chapter/Section title is treated as a Paragraph).- Since:
- 2.1.2
-
leadingCount
protected int leadingCountDeprecated.Signals that the current leading has to be subtracted from a YMark object when positive.- Since:
- 2.1.2
-
anchorAction
Deprecated.The current activePdfActionwhen processing anAnchor. -
textEmptySize
protected int textEmptySizeDeprecated. -
xmpMetadata
protected byte[] xmpMetadataDeprecated.XMP Metadata for the page. -
nextMarginLeft
protected float nextMarginLeftDeprecated.margin in x direction starting from the left. Will be valid in the next page -
nextMarginRight
protected float nextMarginRightDeprecated.margin in x direction starting from the right. Will be valid in the next page -
nextMarginTop
protected float nextMarginTopDeprecated.margin in y direction starting from the top. Will be valid in the next page -
nextMarginBottom
protected float nextMarginBottomDeprecated.margin in y direction starting from the bottom. Will be valid in the next page -
firstPageEvent
protected boolean firstPageEventDeprecated.Signals that OnOpenDocument should be called. -
line
Deprecated.The line that is currently being written. -
lines
Deprecated.The lines that are written until now. -
lastElementType
protected int lastElementTypeDeprecated.Holds the type of the last element, that has been added to the document. -
indentation
Deprecated. -
info
Deprecated.some meta information about the Document. -
rootOutline
Deprecated.This is the root outline of the document. -
currentOutline
Deprecated.This is the currentPdfOutlinein the hierarchy of outlines. -
viewerPreferences
Deprecated.Contains the Viewer preferences of this PDF document. -
pageLabels
Deprecated. -
localDestinations
Deprecated.Stores the destinations keyed by name. Value isObject[]{PdfAction,PdfIndirectReference,PdfDestintion}. -
documentLevelJS
Deprecated. -
documentFileAttachment
Deprecated. -
openActionName
Deprecated. -
openActionAction
Deprecated. -
additionalActions
Deprecated. -
collection
Deprecated. -
markPoint
protected int markPointDeprecated. -
nextPageSize
Deprecated.This is the size of the next page. -
thisBoxSize
Deprecated.This is the size of the several boxes of the current Page. -
boxSize
Deprecated.This is the size of the several boxes that will be used in the next page. -
duration
protected int durationDeprecated.The duration of the page -
transition
Deprecated.The page transition -
pageAA
Deprecated. -
thumb
Deprecated. -
pageResources
protected com.lowagie.text.pdf.PageResources pageResourcesDeprecated.This are the page resources of the current Page. -
strictImageSequence
protected boolean strictImageSequenceDeprecated.Holds value of property strictImageSequence. -
imageEnd
protected float imageEndDeprecated.This is the position where the image ends. -
imageWait
Deprecated.This is the image that could not be shown on a previous page.
-
-
Constructor Details
-
PdfDocument
public PdfDocument()Deprecated.Constructs a new PDF document.
-
-
Method Details
-
addWriter
Deprecated.Adds aPdfWriterto thePdfDocument.- Parameters:
writer- thePdfWriterthat writes everything what is added to this document to an outputstream.- Throws:
DocumentException- on error
-
getLeading
public float getLeading()Deprecated.Getter for the current leading.- Returns:
- the current leading
- Since:
- 2.1.2
-
add
Deprecated.Signals that anElementwas added to theDocument.- Specified by:
addin interfaceElementListener- Overrides:
addin classDocument- Parameters:
element- the element to add- Returns:
trueif the element was added,falseif not.- Throws:
DocumentException- when a document isn't open yet, or has been closed
-
open
public void open()Deprecated.Opens the document.You have to open the document before you can begin to add content to the body of the document.
- Specified by:
openin interfaceDocListener- Overrides:
openin classDocument
-
close
public void close()Deprecated.Closes the document.Once all the content has been written in the body, you have to close the body. After that nothing can be written to the body anymore.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceDocListener- Overrides:
closein classDocument
-
setXmpMetadata
public void setXmpMetadata(byte[] xmpMetadata) Deprecated.Use this method to set the XMP Metadata.- Parameters:
xmpMetadata- The xmpMetadata to set.
-
newPage
public boolean newPage()Deprecated.Makes a new page and sends it to thePdfWriter.- Specified by:
newPagein interfaceDocListener- Overrides:
newPagein classDocument- Returns:
- a
boolean
-
setPageSize
Deprecated.Sets the pagesize.- Specified by:
setPageSizein interfaceDocListener- Overrides:
setPageSizein classDocument- Parameters:
pageSize- the new pagesize- Returns:
trueif the page size was set
-
setMargins
public boolean setMargins(float marginLeft, float marginRight, float marginTop, float marginBottom) Deprecated.Sets the margins.- Specified by:
setMarginsin interfaceDocListener- Overrides:
setMarginsin classDocument- Parameters:
marginLeft- the margin on the leftmarginRight- the margin on the rightmarginTop- the margin on the topmarginBottom- the margin on the bottom- Returns:
- a
boolean
-
setMarginMirroring
public boolean setMarginMirroring(boolean MarginMirroring) Deprecated.Description copied from class:DocumentSet the margin mirroring. It will mirror right/left margins for odd/even pages.Note: it will not work with
Table.- Specified by:
setMarginMirroringin interfaceDocListener- Overrides:
setMarginMirroringin classDocument- Parameters:
MarginMirroring-trueto mirror the margins- Returns:
- always
true - See Also:
-
setMarginMirroringTopBottom
public boolean setMarginMirroringTopBottom(boolean MarginMirroringTopBottom) Deprecated.Description copied from class:DocumentSet the margin mirroring. It will mirror top/bottom margins for odd/even pages.Note: it will not work with
Table.- Specified by:
setMarginMirroringTopBottomin interfaceDocListener- Overrides:
setMarginMirroringTopBottomin classDocument- Parameters:
MarginMirroringTopBottom-trueto mirror the margins- Returns:
- always
true - Since:
- 2.1.6
- See Also:
-
setPageCount
public void setPageCount(int pageN) Deprecated.Sets the page number.- Specified by:
setPageCountin interfaceDocListener- Overrides:
setPageCountin classDocument- Parameters:
pageN- the new page number
-
resetPageCount
public void resetPageCount()Deprecated.Sets the page number to 0.- Specified by:
resetPageCountin interfaceDocListener- Overrides:
resetPageCountin classDocument
-
resetHeader
public void resetHeader()Deprecated.Resets the header of this document.- Specified by:
resetHeaderin interfaceDocListener- Overrides:
resetHeaderin classDocument
-
initPage
Deprecated.Initializes a page.If the footer/header is set, it is printed.
- Throws:
DocumentException- on error
-
newLine
Deprecated.Adds the current line to the list of lines and also adds an empty line.- Throws:
DocumentException- on error
-
carriageReturn
protected void carriageReturn()Deprecated.If the current line is not empty or null, it is added to the arraylist of lines and a new empty line is added. -
getVerticalPosition
public float getVerticalPosition(boolean ensureNewLine) Deprecated.Gets the current vertical page position.- 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.
-
ensureNewLine
protected void ensureNewLine()Deprecated.Ensures that a new line has been started. -
flushLines
Deprecated.Writes all the lines to the text-object.- Returns:
- the displacement that was caused
- Throws:
DocumentException- on error
-
indentLeft
protected float indentLeft()Deprecated.Gets the indentation on the left side.- Returns:
- a margin
-
indentRight
protected float indentRight()Deprecated.Gets the indentation on the right side.- Returns:
- a margin
-
indentTop
protected float indentTop()Deprecated.Gets the indentation on the top side.- Returns:
- a margin
-
addSpacing
Deprecated.Adds extra space. This method should probably be rewritten.- Parameters:
extraspace- extra spaceoldleading- old leadingf- font
-
getInfo
Deprecated.Gets thePdfInfo-object.- Returns:
PdfInfo
-
getRootOutline
Deprecated.Gets the root outline. All the outlines must be created with a parent. The first level is created with this outline.- Returns:
- the root outline
-
setCollection
Deprecated.Sets the collection dictionary.- Parameters:
collection- a dictionary of type PdfCollection
-
setNewPageSizeAndMargins
protected void setNewPageSizeAndMargins()Deprecated. -
clearTextWrap
public void clearTextWrap()Deprecated.Method added by Pelikan Stephan -
add
Deprecated.Adds an image to the document.- Parameters:
image- theImageto add- Throws:
PdfException- on errorDocumentException- on error
-
flushSpecial
protected void flushSpecial()Deprecated.write non-textElementinto document -
addDelay
Deprecated.Occupies space forImagethat will be added later instead of now- Parameters:
image- the newImage
-
delayTableAddition
Deprecated.Occupies space forPdfPTablethat will be added later instead of now- Parameters:
table- the newPdfPTable
-
analyzeRow
Deprecated. -
mayBeRemoved
Deprecated. -
consumeRowspan
Deprecated. -
extractRows
Deprecated. -
renderCells
protected void renderCells(PdfDocument.RenderingContext ctx, List cells, boolean hasToFit) throws DocumentException Deprecated.- Throws:
DocumentException
-
doHeader
Deprecated.- Throws:
DocumentException
-