barcode4j 2.1.0

org.krysalis.barcode4j.output.svg
Class JDOMSVGCanvasProvider

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.JDOMSVGCanvasProvider
All Implemented Interfaces:
CanvasProvider

public class JDOMSVGCanvasProvider
extends AbstractSVGGeneratingCanvasProvider

SVG generating implementation that outputs to a JDOM.

Version:
$Id: JDOMSVGCanvasProvider.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
JDOMSVGCanvasProvider(boolean useNamespace, int orientation)
          Creates a new JDOMSVGCanvasProvider.
JDOMSVGCanvasProvider(int orientation)
          Creates a new JDOMSVGCanvasProvider with default settings (with namespaces, but without namespace prefix).
JDOMSVGCanvasProvider(java.lang.String namespacePrefix, int orientation)
          Creates a new JDOMSVGCanvasProvider 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.jdom.Document getDocument()
          Returns the JDOM document.
 org.w3c.dom.Document getDOM()
          Converts the internal JDOM to a DOM and returns it.
 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

JDOMSVGCanvasProvider

public JDOMSVGCanvasProvider(java.lang.String namespacePrefix,
                             int orientation)
                      throws BarcodeCanvasSetupException
Creates a new JDOMSVGCanvasProvider 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

JDOMSVGCanvasProvider

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

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

JDOMSVGCanvasProvider

public JDOMSVGCanvasProvider(int orientation)
                      throws BarcodeCanvasSetupException
Creates a new JDOMSVGCanvasProvider 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

getDocument

public org.jdom.Document getDocument()
Returns the JDOM document.

Returns:
the JDOM document

getDOM

public org.w3c.dom.Document getDOM()
Converts the internal JDOM to a DOM and returns it.

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.