public class SvgDrawContext extends Object
PdfCanvas instances, which
represent all levels of XObjects that are added to the root canvas.| Constructor and Description |
|---|
SvgDrawContext(ResourceResolver resourceResolver,
FontProvider fontProvider)
Create an instance of the context that is used to store information when converting SVG.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNamedObject(String name,
ISvgNodeRenderer namedObject)
Adds a named object to the draw context.
|
void |
addNamedObjects(Map<String,ISvgNodeRenderer> namedObjects)
* Adds a number of named object to the draw context.
|
void |
addTextMove(float additionalMoveX,
float additionalMoveY)
Increment the stored text move
|
void |
addUsedId(String elementId)
Adds an ID that has been referenced by a use element.
|
void |
addViewPort(com.itextpdf.kernel.geom.Rectangle viewPort)
Adds a viewbox to the context.
|
SvgCssContext |
getCssContext()
Gets the SVG CSS context.
|
com.itextpdf.kernel.pdf.canvas.PdfCanvas |
getCurrentCanvas()
Retrieves the current top of the stack, without modifying the stack.
|
com.itextpdf.kernel.geom.AffineTransform |
getCurrentCanvasTransform()
Get the current canvas transformation
|
com.itextpdf.kernel.geom.Rectangle |
getCurrentViewPort()
Get the current viewbox.
|
FontProvider |
getFontProvider()
Gets the FontProvider to be used during the drawing operations.
|
com.itextpdf.kernel.geom.AffineTransform |
getLastTextTransform()
Get the text transformation that was last applied
|
ISvgNodeRenderer |
getNamedObject(String name)
Get a named object based on its name.
|
float[] |
getPreviousElementTextMove() |
ResourceResolver |
getResourceResolver()
Gets the ResourceResolver to be used during the drawing operations.
|
com.itextpdf.kernel.geom.Rectangle |
getRootViewPort()
Get the viewbox which is the root viewport for the current document.
|
FontSet |
getTempFonts()
Gets list of temporary fonts from @font-face.
|
float[] |
getTextMove()
Get the stored current text move
|
boolean |
isIdUsedByUseTagBefore(String elementId)
Returns true when this id has been used before
|
com.itextpdf.kernel.pdf.canvas.PdfCanvas |
popCanvas()
Retrieves the current top of the stack, thereby taking the current item
off the stack.
|
void |
popPatternId()
Pops the last template id from the stack.
|
void |
pushCanvas(com.itextpdf.kernel.pdf.canvas.PdfCanvas canvas)
Adds a
PdfCanvas to the stack (by definition its top), for use in
drawing operations. |
boolean |
pushPatternId(String patternId)
Add pattern id to stack.
|
void |
removeCurrentViewPort()
Remove the currently set view box.
|
void |
removeUsedId(String elementId)
Removes an ID that has been referenced by a use element.
|
void |
resetTextMove()
Reset the stored text move to [0f,0f]
|
void |
setCssContext(SvgCssContext cssContext)
Sets the SVG CSS context.
|
void |
setLastTextTransform(com.itextpdf.kernel.geom.AffineTransform newTransform)
Set the last text transformation
|
void |
setPreviousElementTextMove(float[] previousElementTextMove) |
void |
setTempFonts(FontSet tempFonts)
Sets the FontSet.
|
int |
size()
Get the current size of the stack, signifying the nesting level of the
XObjects.
|
public SvgDrawContext(ResourceResolver resourceResolver, FontProvider fontProvider)
resourceResolver - instance of ResourceResolverfontProvider - instance of FontProviderpublic com.itextpdf.kernel.pdf.canvas.PdfCanvas getCurrentCanvas()
public com.itextpdf.kernel.pdf.canvas.PdfCanvas popCanvas()
public void pushCanvas(com.itextpdf.kernel.pdf.canvas.PdfCanvas canvas)
PdfCanvas to the stack (by definition its top), for use in
drawing operations.canvas - the new top of the stackpublic int size()
public void addViewPort(com.itextpdf.kernel.geom.Rectangle viewPort)
viewPort - rectangle representing the current viewboxpublic com.itextpdf.kernel.geom.Rectangle getCurrentViewPort()
public com.itextpdf.kernel.geom.Rectangle getRootViewPort()
public void removeCurrentViewPort()
public void addNamedObject(String name, ISvgNodeRenderer namedObject)
name - name of the objectnamedObject - object to be referencedpublic ISvgNodeRenderer getNamedObject(String name)
name - name of the object you want to referencepublic ResourceResolver getResourceResolver()
public void addNamedObjects(Map<String,ISvgNodeRenderer> namedObjects)
namedObjects - Map containing the named objects keyed to their ID stringspublic FontProvider getFontProvider()
public FontSet getTempFonts()
public void setTempFonts(FontSet tempFonts)
tempFonts - font set to be used during drawing operationspublic boolean isIdUsedByUseTagBefore(String elementId)
elementId - element id to checkpublic void addUsedId(String elementId)
elementId - referenced element IDpublic void removeUsedId(String elementId)
elementId - referenced element IDpublic com.itextpdf.kernel.geom.AffineTransform getLastTextTransform()
AffineTransform representing the last text transformationpublic void setLastTextTransform(com.itextpdf.kernel.geom.AffineTransform newTransform)
newTransform - last text transformationpublic float[] getTextMove()
public void resetTextMove()
public void addTextMove(float additionalMoveX,
float additionalMoveY)
additionalMoveX - horizontal value to addadditionalMoveY - vertical value to addpublic com.itextpdf.kernel.geom.AffineTransform getCurrentCanvasTransform()
AffineTransform representing the current canvas transformationpublic SvgCssContext getCssContext()
public void setCssContext(SvgCssContext cssContext)
cssContext - the SVG CSS contextpublic boolean pushPatternId(String patternId)
false and not add, if it is not - add and return true.patternId - pattern idtrue if pattern id was not on the stack and was pushed; false if it is on the stackpublic void popPatternId()
public void setPreviousElementTextMove(float[] previousElementTextMove)
public float[] getPreviousElementTextMove()
Copyright © 1998–2023 iText Group NV. All rights reserved.