Class SVGCanvasProvider
java.lang.Object
org.krysalis.barcode4j.output.AbstractCanvasProvider
org.krysalis.barcode4j.output.AbstractXMLGeneratingCanvasProvider
org.krysalis.barcode4j.output.svg.AbstractSVGGeneratingCanvasProvider
org.krysalis.barcode4j.output.svg.SVGCanvasProvider
- All Implemented Interfaces:
CanvasProvider
Implementation that outputs to a W3C DOM.
- Version:
- $Id: SVGCanvasProvider.java,v 1.6 2009-04-21 15:33:46 jmaerki Exp $
- Author:
- Jeremias Maerki
-
Field Summary
Fields inherited from class org.krysalis.barcode4j.output.svg.AbstractSVGGeneratingCanvasProvider
SVG_NAMESPACEFields inherited from class org.krysalis.barcode4j.output.AbstractCanvasProvider
bardim -
Constructor Summary
ConstructorsConstructorDescriptionSVGCanvasProvider(boolean useNamespace, int orientation) Creates a new SVGCanvasProvider.SVGCanvasProvider(int orientation) Creates a new SVGCanvasProvider with default settings (with namespaces, but without namespace prefix).SVGCanvasProvider(String namespacePrefix, int orientation) Creates a new SVGCanvasProvider with namespaces enabled.SVGCanvasProvider(DOMImplementation domImpl, boolean useNamespace, int orientation) Creates a new SVGCanvasProvider.SVGCanvasProvider(DOMImplementation domImpl, String namespacePrefix, int orientation) Creates a new SVGCanvasProvider with namespaces enabled. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeviceFillRect(double x, double y, double w, double h) Paints a filled rectangle.voiddeviceText(String text, double x1, double x2, double y1, String fontName, double fontSize, TextAlignment textAlign) Draws text.voidSets the dimensions of the barcode.getDOM()Returns the DOM document containing the SVG barcode.Returns the DOM fragment containing the SVG barcode.Methods inherited from class org.krysalis.barcode4j.output.svg.AbstractSVGGeneratingCanvasProvider
getNamespacePrefix, getQualifiedName, isNamespaceEnabledMethods inherited from class org.krysalis.barcode4j.output.AbstractXMLGeneratingCanvasProvider
addUnit, getDecimalFormatMethods inherited from class org.krysalis.barcode4j.output.AbstractCanvasProvider
deviceCenteredText, deviceJustifiedText, getDimensions, getOrientation
-
Constructor Details
-
SVGCanvasProvider
public SVGCanvasProvider(String namespacePrefix, int orientation) throws BarcodeCanvasSetupException Creates a new SVGCanvasProvider with namespaces enabled.- Parameters:
namespacePrefix- the namespace prefix to use, null for no prefixorientation- the barcode orientation (0, 90, 180, 270)- Throws:
BarcodeCanvasSetupException- if setting up the provider fails
-
SVGCanvasProvider
public SVGCanvasProvider(DOMImplementation domImpl, String namespacePrefix, int orientation) throws BarcodeCanvasSetupException Creates a new SVGCanvasProvider with namespaces enabled.- Parameters:
domImpl- DOMImplementation to use (JAXP default is used when this is null)namespacePrefix- the namespace prefix to use, null for no prefixorientation- the barcode orientation (0, 90, 180, 270)- Throws:
BarcodeCanvasSetupException- if setting up the provider fails
-
SVGCanvasProvider
Creates a new SVGCanvasProvider.- Parameters:
useNamespace- Controls whether namespaces should be usedorientation- the barcode orientation (0, 90, 180, 270)- Throws:
BarcodeCanvasSetupException- if setting up the provider fails
-
SVGCanvasProvider
public SVGCanvasProvider(DOMImplementation domImpl, boolean useNamespace, int orientation) throws BarcodeCanvasSetupException Creates a new SVGCanvasProvider.- Parameters:
domImpl- DOMImplementation to use (JAXP default is used when this is null)useNamespace- Controls whether namespaces should be usedorientation- the barcode orientation (0, 90, 180, 270)- Throws:
BarcodeCanvasSetupException- if setting up the provider fails
-
SVGCanvasProvider
Creates a new SVGCanvasProvider with default settings (with namespaces, but without namespace prefix).- Parameters:
orientation- the barcode orientation (0, 90, 180, 270)- Throws:
BarcodeCanvasSetupException- if setting up the provider fails
-
-
Method Details
-
getDOM
Returns the DOM document containing the SVG barcode.- Returns:
- the DOM document
-
getDOMFragment
Returns the DOM fragment containing the SVG barcode.- Returns:
- the DOM fragment
-
establishDimensions
Sets the dimensions of the barcode.- Specified by:
establishDimensionsin interfaceCanvasProvider- Overrides:
establishDimensionsin classAbstractCanvasProvider- Parameters:
dim- the dimensions of the barcode
-
deviceFillRect
public void deviceFillRect(double x, double y, double w, double h) Paints a filled rectangle.- Parameters:
x- x coordinate of the upper left cornery- y coordinate of the upper left cornerw- the widthh- the height
-
deviceText
public void deviceText(String text, double x1, double x2, double y1, String fontName, double fontSize, TextAlignment textAlign) Draws text.- Parameters:
text- the text to drawx1- the left boundaryx2- the right boundaryy1- the y coordinatefontName- the name of the fontfontSize- the size of the fonttextAlign- the text alignment
-