barcode4j 2.1.0

org.krysalis.barcode4j.output.svg
Class SVGCanvasProvider

java.lang.Object
  extended by org.krysalis.barcode4j.output.AbstractCanvasProvider
      extended by org.krysalis.barcode4j.output.AbstractXMLGeneratingCanvasProvider
          extended by org.krysalis.barcode4j.output.svg.AbstractSVGGeneratingCanvasProvider
              extended by org.krysalis.barcode4j.output.svg.SVGCanvasProvider
All Implemented Interfaces:
CanvasProvider

public class SVGCanvasProvider
extends AbstractSVGGeneratingCanvasProvider

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_NAMESPACE
 
Fields inherited from class org.krysalis.barcode4j.output.AbstractCanvasProvider
bardim
 
Constructor Summary
SVGCanvasProvider(boolean useNamespace, int orientation)
          Creates a new SVGCanvasProvider.
SVGCanvasProvider(org.w3c.dom.DOMImplementation domImpl, boolean useNamespace, int orientation)
          Creates a new SVGCanvasProvider.
SVGCanvasProvider(org.w3c.dom.DOMImplementation domImpl, java.lang.String namespacePrefix, int orientation)
          Creates a new SVGCanvasProvider with namespaces enabled.
SVGCanvasProvider(int orientation)
          Creates a new SVGCanvasProvider with default settings (with namespaces, but without namespace prefix).
SVGCanvasProvider(java.lang.String namespacePrefix, int orientation)
          Creates a new SVGCanvasProvider with namespaces enabled.
 
Method Summary
 void deviceFillRect(double x, double y, double w, double h)
          Paints a filled rectangle.
 void deviceText(java.lang.String text, double x1, double x2, double y1, java.lang.String fontName, double fontSize, TextAlignment textAlign)
          Draws text.
 void establishDimensions(BarcodeDimension dim)
          Sets the dimensions of the barcode.
 org.w3c.dom.Document getDOM()
          Returns the DOM document containing the SVG barcode.
 org.w3c.dom.DocumentFragment getDOMFragment()
          Returns the DOM fragment containing the SVG barcode.
 
Methods inherited from class org.krysalis.barcode4j.output.svg.AbstractSVGGeneratingCanvasProvider
getNamespacePrefix, getQualifiedName, isNamespaceEnabled
 
Methods inherited from class org.krysalis.barcode4j.output.AbstractXMLGeneratingCanvasProvider
addUnit, getDecimalFormat
 
Methods inherited from class org.krysalis.barcode4j.output.AbstractCanvasProvider
deviceCenteredText, deviceJustifiedText, getDimensions, getOrientation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SVGCanvasProvider

public SVGCanvasProvider(java.lang.String namespacePrefix,
                         int orientation)
                  throws BarcodeCanvasSetupException
Creates a new SVGCanvasProvider with namespaces enabled.

Parameters:
namespacePrefix - the namespace prefix to use, null for no prefix
orientation - the barcode orientation (0, 90, 180, 270)
Throws:
BarcodeCanvasSetupException - if setting up the provider fails

SVGCanvasProvider

public SVGCanvasProvider(org.w3c.dom.DOMImplementation domImpl,
                         java.lang.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 prefix
orientation - the barcode orientation (0, 90, 180, 270)
Throws:
BarcodeCanvasSetupException - if setting up the provider fails

SVGCanvasProvider

public SVGCanvasProvider(boolean useNamespace,
                         int orientation)
                  throws BarcodeCanvasSetupException
Creates a new SVGCanvasProvider.

Parameters:
useNamespace - Controls whether namespaces should be used
orientation - the barcode orientation (0, 90, 180, 270)
Throws:
BarcodeCanvasSetupException - if setting up the provider fails

SVGCanvasProvider

public SVGCanvasProvider(org.w3c.dom.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 used
orientation - the barcode orientation (0, 90, 180, 270)
Throws:
BarcodeCanvasSetupException - if setting up the provider fails

SVGCanvasProvider

public SVGCanvasProvider(int orientation)
                  throws BarcodeCanvasSetupException
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 Detail

getDOM

public org.w3c.dom.Document getDOM()
Returns the DOM document containing the SVG barcode.

Returns:
the DOM document

getDOMFragment

public org.w3c.dom.DocumentFragment getDOMFragment()
Returns the DOM fragment containing the SVG barcode.

Returns:
the DOM fragment

establishDimensions

public void establishDimensions(BarcodeDimension dim)
Sets the dimensions of the barcode.

Specified by:
establishDimensions in interface CanvasProvider
Overrides:
establishDimensions in class AbstractCanvasProvider
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 corner
y - y coordinate of the upper left corner
w - the width
h - the height

deviceText

public void deviceText(java.lang.String text,
                       double x1,
                       double x2,
                       double y1,
                       java.lang.String fontName,
                       double fontSize,
                       TextAlignment textAlign)
Draws text.

Parameters:
text - the text to draw
x1 - the left boundary
x2 - the right boundary
y1 - the y coordinate
fontName - the name of the font
fontSize - the size of the font
textAlign - the text alignment

barcode4j 2.1.0

Copyright © 2000-2010 Jeremias Maerki. All rights reserved.