Package com.aowagie.text.pdf
Class PdfDocument
- java.lang.Object
-
- com.aowagie.text.Document
-
- com.aowagie.text.pdf.PdfDocument
-
- All Implemented Interfaces:
DocListener,ElementListener,java.util.EventListener
class PdfDocument extends Document
PdfDocumentis the class that is used byPdfWriterto translate aDocumentinto a PDF with different pages.A
PdfDocumentalways listens to aDocumentand adds the Pdf representation of everyElementthat is added to theDocument.- Since:
- 2.0.8 (class was package-private before)
- See Also:
Document,DocListener,PdfWriter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classPdfDocument.Indentationprivate static classPdfDocument.PdfCatalogPdfCatalogis the PDF Catalog-object.private static classPdfDocument.PdfInfoPdfInfois the PDF InfoDictionary.private static classPdfDocument.RenderingContextThis is a helper class for adding a Table to a document.
-
Field Summary
Fields Modifier and Type Field Description private PdfDictionaryadditionalActionsprivate intalignmentThis represents the current alignment of the PDF Elements.protected PdfActionanchorActionThe current activePdfActionwhen processing anAnchor.private PdfAnnotationsImpannotationsImpprivate java.util.HashMapboxSizeThis is the size of the several boxes that will be used in the next page.private PdfCollectioncollectionprivate floatcurrentHeightThis is the current height of the document.private PdfOutlinecurrentOutlineThis is the currentPdfOutlinein the hierarchy of outlines.private java.util.HashMapdocumentFileAttachmentprivate java.util.HashMapdocumentLevelJSprivate intdurationThe duration of the pageprivate booleanfirstPageEventSignals that OnOpenDocument should be called.private PdfContentBytegraphicsThis is the PdfContentByte object, containing the borders and other Graphics.private static java.lang.StringhangingPunctuationThe characters to be applied the hanging punctuation.private floatimageEndThis is the position where the image ends.private ImageimageWaitThis is the image that could not be shown on a previous page.private PdfDocument.Indentationindentationprivate PdfDocument.PdfInfoinfosome meta information about the Document.protected booleanisSectionTitleSignals that onParagraph is valid (to avoid that a Chapter/Section title is treated as a Paragraph).private intjsCounterStores a list of document level JavaScript actions.private intlastElementTypeHolds the type of the last element, that has been added to the document.private floatleadingThis represents the leading of the lines.protected intleadingCountSignals that the current leading has to be subtracted from a YMark object when positive.private PdfLinelineThe line that is currently being written.private java.util.ArrayListlinesThe lines that are written until now.private java.util.TreeMaplocalDestinationsStores the destinations keyed by name.private intmarkPointprivate floatnextMarginBottommargin in y direction starting from the bottom.private floatnextMarginLeftmargin in x direction starting from the left.private floatnextMarginRightmargin in x direction starting from the right.private floatnextMarginTopmargin in y direction starting from the top.private RectanglenextPageSizeThis is the size of the next page.private PdfActionopenActionActionprivate java.lang.StringopenActionNameprivate PdfDictionarypageAAprivate booleanpageEmptyThis checks if the page is empty.protected PdfPageLabelspageLabelsprivate PageResourcespageResourcesThis are the page resources of the current Page.private PdfOutlinerootOutlineThis is the root outline of the document.private static java.text.DecimalFormatSIXTEEN_DIGITSprivate booleanstrictImageSequenceHolds value of property strictImageSequence.private PdfContentBytetextThis is the PdfContentByte object, containing the text.private inttextEmptySizeprivate java.util.HashMapthisBoxSizeThis is the size of the several boxes of the current Page.private PdfIndirectReferencethumbprivate PdfTransitiontransitionThe page transitionprivate PdfViewerPreferencesImpviewerPreferencesContains the Viewer preferences of this PDF document.private PdfWriterwriterThePdfWriter.private byte[]xmpMetadataXMP Metadata for the page.-
Fields inherited from class com.aowagie.text.Document
close, compress, footer, header, marginBottom, marginLeft, marginMirroring, marginMirroringTopBottom, marginRight, marginTop, open, pageN, pageSize, plainRandomAccess, wmfFontCorrection
-
-
Constructor Summary
Constructors Constructor Description PdfDocument()PdfDocument(java.util.Calendar globalDate)Constructs a new PDF document.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(Element element)Signals that anElementwas added to theDocument.private voidadd(Image image)Adds an image to the document.(package private) voidaddAdditionalAction(PdfName actionType, PdfAction action)(package private) voidaddAnnotation(PdfAnnotation annot)(package private) voidaddCalculationOrder(PdfFormField formField)(package private) voidaddFileAttachment(java.lang.String description, PdfFileSpecification fs)(package private) voidaddJavaScript(PdfAction js)(package private) voidaddJavaScript(java.lang.String name, PdfAction js)(package private) voidaddOutline(PdfOutline outline, java.lang.String name)Adds a named outline to the document .private voidaddPdfTable(Table t)Adds a new table to the document.(package private) voidaddPTable(PdfPTable ptable)Adds aPdfPTableto the document.protected voidaddSpacing(float extraspace, float oldleading, Font f)Adds extra space.(package private) voidaddViewerPreference(PdfName key, PdfObject value)(package private) voidaddWriter(PdfWriter writer)Adds aPdfWriterto thePdfDocument.private voidanalyzeRow(java.util.ArrayList rows, PdfDocument.RenderingContext ctx)(package private) floatbottom(Table table)Returns the bottomvalue of aTableif it were added to this document.private voidcalculateOutlineCount()Updates the count in the outlines.private voidcarriageReturn()If the current line is not empty or null, it is added to the arraylist of lines and a new empty line is added.voidclearTextWrap()Method added by Pelikan Stephanvoidclose()Closes the document.private voidconsumeRowspan(java.util.ArrayList row, PdfDocument.RenderingContext ctx)private voiddoFooter()private voiddoHeader()private voidensureNewLine()Ensures that a new line has been started.private java.util.ArrayListextractRows(java.util.ArrayList cells, PdfDocument.RenderingContext ctx)private booleanfitsPage(PdfPTable table, float margin)Checks if aPdfPTablefits the current page of thePdfDocument.private floatflushLines()Writes all the lines to the text-object.(package private) PdfAcroFormgetAcroForm()Gets the AcroForm object.(package private) RectanglegetBoxSize(java.lang.String boxName)Gives the size of a trim, art, crop or bleed box, or null if not defined.(package private) PdfDocument.PdfCataloggetCatalog(PdfIndirectReference pages)Gets thePdfCatalog-object.(package private) java.util.HashMapgetDocumentFileAttachment()(package private) java.util.HashMapgetDocumentLevelJS()(package private) PdfDocument.PdfInfogetInfo()Gets thePdfInfo-object.floatgetLeading()Getter for the current leading.private PdfActiongetLocalGotoAction(java.lang.String name)(package private) intgetMarkPoint()(package private) PageResourcesgetPageResources()PdfOutlinegetRootOutline()Gets the root outline.floatgetVerticalPosition(boolean ensureNewLine)Gets the current vertical page position.(package private) voidincMarkPoint()(package private) floatindentBottom()Gets the indentation on the bottom side.private floatindentLeft()Gets the indentation on the left side.private floatindentRight()Gets the indentation on the right side.private floatindentTop()Gets the indentation on the top side.private voidinitPage()Initializes a page.(package private) booleanisStrictImageSequence()Getter for property strictImageSequence.private booleanlocalDestination(java.lang.String name, PdfDestination destination)The local destination to where a local goto with the same name will jump to.private voidlocalGoto(java.lang.String name, float llx, float lly, float urx, float ury)Implements a link to other part of the document.private booleanmayBeRemoved(java.util.ArrayList row)private voidnewLine()Adds the current line to the list of lines and also adds an empty line.booleannewPage()Makes a new page and sends it to thePdfWriter.voidopen()Opens the document.private voidoutlineTree(PdfOutline outline)Recursive method used to write outlines.private voidremoteGoto(java.lang.String filename, int page, float llx, float lly, float urx, float ury)Implements a link to another document.private voidremoteGoto(java.lang.String filename, java.lang.String name, float llx, float lly, float urx, float ury)Implements a link to another document.private voidrenderCells(PdfDocument.RenderingContext ctx, java.util.List cells, boolean hasToFit)voidresetFooter()Resets the footer of this document.voidresetHeader()Resets the header of this document.voidresetPageCount()Sets the page number to 0.(package private) voidsetAction(PdfAction action, float llx, float lly, float urx, float ury)Implements an action in an area.private voidsetBoxSize(java.lang.String boxName, Rectangle size)voidsetCollection(PdfCollection collection)Sets the collection dictionary.(package private) voidsetCropBoxSize(Rectangle crop)(package private) voidsetDuration(int seconds)Sets the display duration for the page (for presentations)voidsetFooter(HeaderFooter footer)Changes the footer of this document.voidsetHeader(HeaderFooter header)Changes the header of this document.(package private) voidsetLeading(float leading)Setter for the current leading.booleansetMarginMirroring(boolean MarginMirroring)Set the margin mirroring.booleansetMarginMirroringTopBottom(boolean MarginMirroringTopBottom)Set the margin mirroring.booleansetMargins(float marginLeft, float marginRight, float marginTop, float marginBottom)Sets the margins.private voidsetNewPageSizeAndMargins()(package private) voidsetOpenAction(PdfAction action)(package private) voidsetOpenAction(java.lang.String name)(package private) voidsetPageAction(PdfName actionType, PdfAction action)voidsetPageCount(int pageN)Sets the page number.(package private) voidsetPageEmpty(boolean pageEmpty)(package private) voidsetPageLabels(PdfPageLabels pageLabels)Sets the page labelsbooleansetPageSize(Rectangle pageSize)Sets the pagesize.(package private) voidsetSigFlags(int f)(package private) voidsetStrictImageSequence(boolean strictImageSequence)Setter for property strictImageSequence.(package private) voidsetThumbnail(Image image)(package private) voidsetTransition(PdfTransition transition)Sets the transition for the page(package private) voidsetViewerPreferences(int preferences)voidsetXmpMetadata(byte[] xmpMetadata)Use this method to set the XMP Metadata.private voidtraverseOutlineCount(PdfOutline outline)Recursive method to update the count in the outlines.(package private) voidwriteLineToContent(PdfLine line, PdfContentByte text, PdfContentByte graphics, java.lang.Object[] currentValues, float ratio)Writes a text line to the document.private voidwriteOutlines()Writes the outline tree to the body of the PDF document.-
Methods inherited from class com.aowagie.text.Document
addAuthor, addCreationDate, addCreationDate, addCreator, addDocListener, addHeader, addKeywords, addProducer, addSubject, addTitle, bottom, bottom, bottomMargin, getHtmlStyleClass, getJavaScript_onLoad, getJavaScript_onUnLoad, getPageNumber, getPageSize, getProduct, getRelease, getVersion, isMarginMirroring, isOpen, left, left, leftMargin, removeDocListener, right, right, rightMargin, setHtmlStyleClass, setJavaScript_onLoad, setJavaScript_onUnLoad, top, top, topMargin
-
-
-
-
Field Detail
-
writer
private PdfWriter writer
ThePdfWriter.
-
text
private PdfContentByte text
This is the PdfContentByte object, containing the text.
-
graphics
private PdfContentByte graphics
This is the PdfContentByte object, containing the borders and other Graphics.
-
leading
private float leading
This represents the leading of the lines.
-
alignment
private int alignment
This represents the current alignment of the PDF Elements.
-
currentHeight
private float currentHeight
This is the current height of the document.
-
isSectionTitle
protected boolean isSectionTitle
Signals that onParagraph is valid (to avoid that a Chapter/Section title is treated as a Paragraph).- Since:
- 2.1.2
-
leadingCount
protected int leadingCount
Signals that the current leading has to be subtracted from a YMark object when positive.- Since:
- 2.1.2
-
anchorAction
protected PdfAction anchorAction
The current activePdfActionwhen processing anAnchor.
-
textEmptySize
private int textEmptySize
-
xmpMetadata
private byte[] xmpMetadata
XMP Metadata for the page.
-
nextMarginLeft
private float nextMarginLeft
margin in x direction starting from the left. Will be valid in the next page
-
nextMarginRight
private float nextMarginRight
margin in x direction starting from the right. Will be valid in the next page
-
nextMarginTop
private float nextMarginTop
margin in y direction starting from the top. Will be valid in the next page
-
nextMarginBottom
private float nextMarginBottom
margin in y direction starting from the bottom. Will be valid in the next page
-
firstPageEvent
private boolean firstPageEvent
Signals that OnOpenDocument should be called.
-
line
private PdfLine line
The line that is currently being written.
-
lines
private java.util.ArrayList lines
The lines that are written until now.
-
lastElementType
private int lastElementType
Holds the type of the last element, that has been added to the document.
-
hangingPunctuation
private static final java.lang.String hangingPunctuation
The characters to be applied the hanging punctuation.- See Also:
- Constant Field Values
-
indentation
private final PdfDocument.Indentation indentation
-
info
private PdfDocument.PdfInfo info
some meta information about the Document.
-
rootOutline
private PdfOutline rootOutline
This is the root outline of the document.
-
currentOutline
private PdfOutline currentOutline
This is the currentPdfOutlinein the hierarchy of outlines.
-
viewerPreferences
private final PdfViewerPreferencesImp viewerPreferences
Contains the Viewer preferences of this PDF document.
-
pageLabels
protected PdfPageLabels pageLabels
-
localDestinations
private final java.util.TreeMap localDestinations
Stores the destinations keyed by name. Value isObject[]{PdfAction,PdfIndirectReference,PdfDestintion}.
-
jsCounter
private int jsCounter
Stores a list of document level JavaScript actions.
-
documentLevelJS
private final java.util.HashMap documentLevelJS
-
SIXTEEN_DIGITS
private static final java.text.DecimalFormat SIXTEEN_DIGITS
-
documentFileAttachment
private final java.util.HashMap documentFileAttachment
-
openActionName
private java.lang.String openActionName
-
openActionAction
private PdfAction openActionAction
-
additionalActions
private PdfDictionary additionalActions
-
collection
private PdfCollection collection
-
annotationsImp
private PdfAnnotationsImp annotationsImp
-
markPoint
private int markPoint
-
nextPageSize
private Rectangle nextPageSize
This is the size of the next page.
-
thisBoxSize
private java.util.HashMap thisBoxSize
This is the size of the several boxes of the current Page.
-
boxSize
private final java.util.HashMap boxSize
This is the size of the several boxes that will be used in the next page.
-
pageEmpty
private boolean pageEmpty
This checks if the page is empty.
-
duration
private int duration
The duration of the page
-
transition
private PdfTransition transition
The page transition
-
pageAA
private PdfDictionary pageAA
-
thumb
private PdfIndirectReference thumb
-
pageResources
private PageResources pageResources
This are the page resources of the current Page.
-
strictImageSequence
private boolean strictImageSequence
Holds value of property strictImageSequence.
-
imageEnd
private float imageEnd
This is the position where the image ends.
-
imageWait
private Image imageWait
This is the image that could not be shown on a previous page.
-
-
Method Detail
-
addWriter
void addWriter(PdfWriter writer) throws DocumentException
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()
Getter for the current leading.- Returns:
- the current leading
- Since:
- 2.1.2
-
setLeading
void setLeading(float leading)
Setter for the current leading.- Parameters:
leading- the current leading- Since:
- 2.1.6
-
add
public boolean add(Element element) throws DocumentException
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()
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()
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 interfaceDocListener- Overrides:
closein classDocument
-
setXmpMetadata
public void setXmpMetadata(byte[] xmpMetadata)
Use this method to set the XMP Metadata.- Parameters:
xmpMetadata- The xmpMetadata to set.
-
newPage
public boolean newPage()
Makes a new page and sends it to thePdfWriter.- Specified by:
newPagein interfaceDocListener- Overrides:
newPagein classDocument- Returns:
- a
boolean
-
setPageSize
public boolean setPageSize(Rectangle pageSize)
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)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)
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:
DocListener.setMarginMirroring(boolean)
-
setMarginMirroringTopBottom
public boolean setMarginMirroringTopBottom(boolean MarginMirroringTopBottom)
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:
DocListener.setMarginMirroring(boolean)
-
setPageCount
public void setPageCount(int pageN)
Sets the page number.- Specified by:
setPageCountin interfaceDocListener- Overrides:
setPageCountin classDocument- Parameters:
pageN- the new page number
-
resetPageCount
public void resetPageCount()
Sets the page number to 0.- Specified by:
resetPageCountin interfaceDocListener- Overrides:
resetPageCountin classDocument
-
setHeader
public void setHeader(HeaderFooter header)
Changes the header of this document.- Specified by:
setHeaderin interfaceDocListener- Overrides:
setHeaderin classDocument- Parameters:
header- the new header
-
resetHeader
public void resetHeader()
Resets the header of this document.- Specified by:
resetHeaderin interfaceDocListener- Overrides:
resetHeaderin classDocument
-
setFooter
public void setFooter(HeaderFooter footer)
Changes the footer of this document.- Specified by:
setFooterin interfaceDocListener- Overrides:
setFooterin classDocument- Parameters:
footer- the new footer
-
resetFooter
public void resetFooter()
Resets the footer of this document.- Specified by:
resetFooterin interfaceDocListener- Overrides:
resetFooterin classDocument
-
initPage
private void initPage() throws DocumentExceptionInitializes a page.If the footer/header is set, it is printed.
- Throws:
DocumentException- on error
-
newLine
private void newLine() throws DocumentExceptionAdds the current line to the list of lines and also adds an empty line.- Throws:
DocumentException- on error
-
carriageReturn
private void carriageReturn()
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)
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
private void ensureNewLine()
Ensures that a new line has been started.
-
flushLines
private float flushLines() throws DocumentExceptionWrites all the lines to the text-object.- Returns:
- the displacement that was caused
- Throws:
DocumentException- on error
-
writeLineToContent
void writeLineToContent(PdfLine line, PdfContentByte text, PdfContentByte graphics, java.lang.Object[] currentValues, float ratio) throws DocumentException
Writes a text line to the document. It takes care of all the attributes.Before entering the line position must have been established and the
textargument must be in text object scope (beginText()).- Parameters:
line- the line to be writtentext- thePdfContentBytewhere the text will be written tographics- thePdfContentBytewhere the graphics will be written tocurrentValues- the current font and extra spacing valuesratio-- Throws:
DocumentException- on error
-
indentLeft
private float indentLeft()
Gets the indentation on the left side.- Returns:
- a margin
-
indentRight
private float indentRight()
Gets the indentation on the right side.- Returns:
- a margin
-
indentTop
private float indentTop()
Gets the indentation on the top side.- Returns:
- a margin
-
indentBottom
float indentBottom()
Gets the indentation on the bottom side.- Returns:
- a margin
-
addSpacing
protected void addSpacing(float extraspace, float oldleading, Font f)Adds extra space. This method should probably be rewritten.
-
getInfo
PdfDocument.PdfInfo getInfo()
Gets thePdfInfo-object.- Returns:
PdfInfo
-
getCatalog
PdfDocument.PdfCatalog getCatalog(PdfIndirectReference pages)
Gets thePdfCatalog-object.- Parameters:
pages- an indirect reference to this document pages- Returns:
PdfCatalog
-
addOutline
void addOutline(PdfOutline outline, java.lang.String name)
Adds a named outline to the document .- Parameters:
outline- the outline to be addedname- the name of this local destination
-
getRootOutline
public PdfOutline getRootOutline()
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
-
calculateOutlineCount
private void calculateOutlineCount()
Updates the count in the outlines.
-
traverseOutlineCount
private void traverseOutlineCount(PdfOutline outline)
Recursive method to update the count in the outlines.
-
writeOutlines
private void writeOutlines() throws java.io.IOExceptionWrites the outline tree to the body of the PDF document.- Throws:
java.io.IOException
-
outlineTree
private void outlineTree(PdfOutline outline) throws java.io.IOException
Recursive method used to write outlines.- Throws:
java.io.IOException
-
setViewerPreferences
void setViewerPreferences(int preferences)
-
setPageLabels
void setPageLabels(PdfPageLabels pageLabels)
Sets the page labels- Parameters:
pageLabels- the page labels
-
localGoto
private void localGoto(java.lang.String name, float llx, float lly, float urx, float ury)Implements a link to other part of the document. The jump will be made to a local destination with the same name, that must exist.- Parameters:
name- the name for this linkllx- the lower left x corner of the activation areally- the lower left y corner of the activation areaurx- the upper right x corner of the activation areaury- the upper right y corner of the activation area
-
remoteGoto
private void remoteGoto(java.lang.String filename, java.lang.String name, float llx, float lly, float urx, float ury)Implements a link to another document.- Parameters:
filename- the filename for the remote documentname- the name to jump tollx- the lower left x corner of the activation areally- the lower left y corner of the activation areaurx- the upper right x corner of the activation areaury- the upper right y corner of the activation area
-
remoteGoto
private void remoteGoto(java.lang.String filename, int page, float llx, float lly, float urx, float ury)Implements a link to another document.- Parameters:
filename- the filename for the remote documentpage- the page to jump tollx- the lower left x corner of the activation areally- the lower left y corner of the activation areaurx- the upper right x corner of the activation areaury- the upper right y corner of the activation area
-
setAction
void setAction(PdfAction action, float llx, float lly, float urx, float ury)
Implements an action in an area.- Parameters:
action- thePdfActionllx- the lower left x corner of the activation areally- the lower left y corner of the activation areaurx- the upper right x corner of the activation areaury- the upper right y corner of the activation area
-
getLocalGotoAction
private PdfAction getLocalGotoAction(java.lang.String name)
-
localDestination
private boolean localDestination(java.lang.String name, PdfDestination destination)The local destination to where a local goto with the same name will jump to.- Parameters:
name- the name of this local destinationdestination- thePdfDestinationwith the jump coordinates- Returns:
trueif the local destination was added,falseif a local destination with the same name already existed
-
addJavaScript
void addJavaScript(PdfAction js)
-
addJavaScript
void addJavaScript(java.lang.String name, PdfAction js)
-
getDocumentLevelJS
java.util.HashMap getDocumentLevelJS()
-
addFileAttachment
void addFileAttachment(java.lang.String description, PdfFileSpecification fs) throws java.io.IOException- Throws:
java.io.IOException
-
getDocumentFileAttachment
java.util.HashMap getDocumentFileAttachment()
-
setOpenAction
void setOpenAction(java.lang.String name)
-
setOpenAction
void setOpenAction(PdfAction action)
-
setCollection
public void setCollection(PdfCollection collection)
Sets the collection dictionary.- Parameters:
collection- a dictionary of type PdfCollection
-
getAcroForm
PdfAcroForm getAcroForm()
Gets the AcroForm object.- Returns:
- the PdfAcroform object of the PdfDocument
-
setSigFlags
void setSigFlags(int f)
-
addCalculationOrder
void addCalculationOrder(PdfFormField formField)
-
addAnnotation
void addAnnotation(PdfAnnotation annot)
-
getMarkPoint
int getMarkPoint()
-
incMarkPoint
void incMarkPoint()
-
setCropBoxSize
void setCropBoxSize(Rectangle crop)
-
setBoxSize
private void setBoxSize(java.lang.String boxName, Rectangle size)
-
setNewPageSizeAndMargins
private void setNewPageSizeAndMargins()
-
getBoxSize
Rectangle getBoxSize(java.lang.String boxName)
Gives the size of a trim, art, crop or bleed box, or null if not defined.- Parameters:
boxName- crop, trim, art or bleed
-
setPageEmpty
void setPageEmpty(boolean pageEmpty)
-
setDuration
void setDuration(int seconds)
Sets the display duration for the page (for presentations)- Parameters:
seconds- the number of seconds to display the page
-
setTransition
void setTransition(PdfTransition transition)
Sets the transition for the page- Parameters:
transition- the PdfTransition object
-
setThumbnail
void setThumbnail(Image image) throws PdfException, DocumentException
- Throws:
PdfExceptionDocumentException
-
getPageResources
PageResources getPageResources()
-
isStrictImageSequence
boolean isStrictImageSequence()
Getter for property strictImageSequence.- Returns:
- Value of property strictImageSequence.
-
setStrictImageSequence
void setStrictImageSequence(boolean strictImageSequence)
Setter for property strictImageSequence.- Parameters:
strictImageSequence- New value of property strictImageSequence.
-
clearTextWrap
public void clearTextWrap()
Method added by Pelikan Stephan
-
add
private void add(Image image) throws PdfException, DocumentException
Adds an image to the document.- Parameters:
image- theImageto add- Throws:
PdfException- on errorDocumentException- on error
-
addPTable
void addPTable(PdfPTable ptable) throws DocumentException
Adds aPdfPTableto the document.- Parameters:
ptable- thePdfPTableto be added to the document.- Throws:
DocumentException- on error
-
fitsPage
private boolean fitsPage(PdfPTable table, float margin)
Checks if aPdfPTablefits the current page of thePdfDocument.- Parameters:
table- the table that has to be checkedmargin- a certain margin- Returns:
trueif thePdfPTablefits the page,falseotherwise.
-
addPdfTable
private void addPdfTable(Table t) throws DocumentException
Adds a new table to the document.- Parameters:
t- Table to add. Rendered rows will be deleted after processing.- Throws:
DocumentException- Since:
- iText 2.0.8
-
analyzeRow
private void analyzeRow(java.util.ArrayList rows, PdfDocument.RenderingContext ctx)
-
mayBeRemoved
private boolean mayBeRemoved(java.util.ArrayList row)
-
consumeRowspan
private void consumeRowspan(java.util.ArrayList row, PdfDocument.RenderingContext ctx)
-
extractRows
private java.util.ArrayList extractRows(java.util.ArrayList cells, PdfDocument.RenderingContext ctx)
-
renderCells
private void renderCells(PdfDocument.RenderingContext ctx, java.util.List cells, boolean hasToFit) throws DocumentException
- Throws:
DocumentException
-
bottom
float bottom(Table table)
Returns the bottomvalue of aTableif it were added to this document.- Parameters:
table- the table that may or may not be added to this document- Returns:
- a bottom value
-
doFooter
private void doFooter() throws DocumentException- Throws:
DocumentException
-
doHeader
private void doHeader() throws DocumentException- Throws:
DocumentException
-
-