public class Canvas extends RootElement<Canvas>
Modifier and Type | Field and Description |
---|---|
protected PdfPage |
page
Is initialized and used only when Canvas element autotagging is enabled, see enableAutoTagging(PdfPage) .
|
protected PdfCanvas |
pdfCanvas |
protected Rectangle |
rootArea |
childElements, defaultFont, defaultFontProvider, defaultSplitCharacters, immediateFlush, pdfDocument, properties, rootRenderer
Constructor and Description |
---|
Canvas(PdfCanvas pdfCanvas, PdfDocument pdfDocument, Rectangle rootArea)
Creates a new Canvas to manipulate a specific document and page.
|
Canvas(PdfCanvas pdfCanvas, PdfDocument pdfDocument, Rectangle rootArea, boolean immediateFlush)
Creates a new Canvas to manipulate a specific document and page.
|
Canvas(PdfFormXObject formXObject, PdfDocument pdfDocument)
Creates a new Canvas to manipulate a specific PdfFormXObject .
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the Canvas .
|
void |
enableAutoTagging(PdfPage page)
Enables canvas content autotagging.
|
protected RootRenderer |
ensureRootRendererNotNull() |
void |
flush()
Forces all registered renderers (including child element renderers) to flush their contents to the content stream.
|
PdfPage |
getPage()
Returned value is not null only in case when autotagging is enabled.
|
PdfCanvas |
getPdfCanvas()
Gets the PdfCanvas .
|
PdfDocument |
getPdfDocument()
Gets the PdfDocument for this canvas.
|
Rectangle |
getRootArea()
Gets the root area rectangle.
|
boolean |
isAutoTaggingEnabled() |
void |
relayout()
Performs an entire recalculation of the element flow on the canvas, taking into account all its current child elements.
|
void |
setRenderer(CanvasRenderer canvasRenderer)
Sets the IRenderer for this Canvas.
|
add, add, deleteOwnProperty, getDefaultProperty, getFontProvider, getOwnProperty, getProperty, getRenderer, hasOwnProperty, hasProperty, setFontProvider, setProperty, showTextAligned, showTextAligned, showTextAligned, showTextAligned, showTextAligned, showTextAligned, showTextAlignedKerned
getHeight, getSplitCharacters, getStrokeColor, getStrokeWidth, getTextRenderingMode, getWidth, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBaseDirection, setBold, setBorder, setBorderBottom, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderLeft, setBorderRadius, setBorderRight, setBorderTop, setBorderTopLeftRadius, setBorderTopRightRadius, setCharacterSpacing, setDestination, setFixedPosition, setFixedPosition, setFixedPosition, setFixedPosition, setFont, setFont, setFontColor, setFontColor, setFontKerning, setFontScript, setFontSize, setHeight, setHeight, setHeightPercent, setHorizontalAlignment, setHyphenation, setItalic, setLineThrough, setOpacity, setRelativePosition, setSplitCharacters, setStrokeColor, setStrokeWidth, setTextAlignment, setTextRenderingMode, setUnderline, setUnderline, setUnderline, setUnderline, setWidth, setWidth, setWidthPercent, setWordSpacing
protected PdfCanvas pdfCanvas
protected Rectangle rootArea
protected PdfPage page
enableAutoTagging(PdfPage)
. It is also used to determine if autotagging is enabled.
public Canvas(PdfCanvas pdfCanvas, PdfDocument pdfDocument, Rectangle rootArea)
pdfCanvas
- the low-level content stream writer
pdfDocument
- the document that the resulting content stream will be written to
rootArea
- the maximum area that the Canvas may write upon
public Canvas(PdfCanvas pdfCanvas, PdfDocument pdfDocument, Rectangle rootArea, boolean immediateFlush)
pdfCanvas
- The low-level content stream writer
pdfDocument
- The document that the resulting content stream will be written to
rootArea
- The maximum area that the Canvas may write upon
immediateFlush
- Whether to flush the canvas immediately after operations, false otherwise
public Canvas(PdfFormXObject formXObject, PdfDocument pdfDocument)
PdfFormXObject
.
formXObject
- the form
pdfDocument
- the document that the resulting content stream will be written to
public PdfDocument getPdfDocument()
PdfDocument
for this canvas.
public Rectangle getRootArea()
public PdfCanvas getPdfCanvas()
PdfCanvas
.
public void setRenderer(CanvasRenderer canvasRenderer)
IRenderer
for this Canvas.
canvasRenderer
- a renderer specific for canvas operations
public PdfPage getPage()
public void enableAutoTagging(PdfPage page)
page
- the page, on which this canvas will be rendered.
public boolean isAutoTaggingEnabled()
public void relayout()
RootElement.immediateFlush
to true
.
public void flush()
public void close()
Canvas
. Although not completely necessary in all cases, it is still recommended to call this method when you are done working with Canvas
object, as due to some properties set there might be some 'hanging' elements, which are waiting other elements to be added and processed. close()
tells the Canvas
that no more elements will be added and it is time to finish processing all the elements.
protected RootRenderer ensureRootRendererNotNull()
ensureRootRendererNotNull
in class RootElement<Canvas>
Copyright © 1998–2018 iText Group NV. All rights reserved.