|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.batik.transcoder.TranscoderSupport | +--org.apache.batik.transcoder.AbstractTranscoder | +--org.apache.batik.transcoder.XMLAbstractTranscoder | +--org.apache.batik.transcoder.print.PrintTranscoder
This class is a Transcoder that prints SVG images.
This class works as follows: any-time the transcode method
is invoked, the corresponding input is cached and nothing
else happens.
However, the PrintTranscoder is also a Printable. If used
in a print operation, it will print each of the input
it cached, one input per page.
The PrintTranscoder uses several different hints that
guide its printing:
Inner Class Summary | |
protected class |
PrintTranscoder.PrintTranscoderUserAgent
A user agent implementation for PrintTranscoder. |
Field Summary | |
protected static java.util.Set |
FEATURES
|
static TranscodingHints.Key |
KEY_AOI
The area of interest key. |
static java.lang.String |
KEY_AOI_STR
|
static TranscodingHints.Key |
KEY_HEIGHT
The image height key. |
static java.lang.String |
KEY_HEIGHT_STR
|
static TranscodingHints.Key |
KEY_LANGUAGE
The language key. |
static java.lang.String |
KEY_LANGUAGE_STR
|
static TranscodingHints.Key |
KEY_MARGIN_BOTTOM
The marginBottom key. |
static java.lang.String |
KEY_MARGIN_BOTTOM_STR
|
static TranscodingHints.Key |
KEY_MARGIN_LEFT
The marginLeft key. |
static java.lang.String |
KEY_MARGIN_LEFT_STR
|
static TranscodingHints.Key |
KEY_MARGIN_RIGHT
The marginRight key. |
static java.lang.String |
KEY_MARGIN_RIGHT_STR
|
static TranscodingHints.Key |
KEY_MARGIN_TOP
The marginTop key. |
static java.lang.String |
KEY_MARGIN_TOP_STR
|
static TranscodingHints.Key |
KEY_MEDIA
The CSS media. |
static TranscodingHints.Key |
KEY_PAGE_HEIGHT
The pageHeight key. |
static java.lang.String |
KEY_PAGE_HEIGHT_STR
|
static TranscodingHints.Key |
KEY_PAGE_ORIENTATION
The pageOrientation key. |
static java.lang.String |
KEY_PAGE_ORIENTATION_STR
|
static TranscodingHints.Key |
KEY_PAGE_WIDTH
The pageWidth key. |
static java.lang.String |
KEY_PAGE_WIDTH_STR
|
static TranscodingHints.Key |
KEY_PIXEL_TO_MM
The pixel to millimeter conversion factor key. |
static java.lang.String |
KEY_PIXEL_TO_MM_STR
|
static TranscodingHints.Key |
KEY_SCALE_TO_PAGE
The scaleToPage key. |
static java.lang.String |
KEY_SCALE_TO_PAGE_STR
|
static TranscodingHints.Key |
KEY_SHOW_PAGE_DIALOG
The showPageDialog key. |
static java.lang.String |
KEY_SHOW_PAGE_DIALOG_STR
|
static TranscodingHints.Key |
KEY_SHOW_PRINTER_DIALOG
The showPrinterDialog key. |
static java.lang.String |
KEY_SHOW_PRINTER_DIALOG_STR
|
static TranscodingHints.Key |
KEY_USER_STYLESHEET_URI
The user stylesheet URI key. |
static java.lang.String |
KEY_USER_STYLESHEET_URI_STR
|
static TranscodingHints.Key |
KEY_WIDTH
The image width key. |
static java.lang.String |
KEY_WIDTH_STR
|
static java.lang.String |
KEY_XML_PARSER_CLASSNAME_STR
|
static java.lang.String |
USAGE
|
static java.lang.String |
VALUE_MEDIA_PRINT
|
static java.lang.String |
VALUE_PAGE_ORIENTATION_LANDSCAPE
|
static java.lang.String |
VALUE_PAGE_ORIENTATION_PORTRAIT
|
static java.lang.String |
VALUE_PAGE_ORIENTATION_REVERSE_LANDSCAPE
|
Fields inherited from class org.apache.batik.transcoder.XMLAbstractTranscoder |
KEY_DOCUMENT_ELEMENT, KEY_DOCUMENT_ELEMENT_NAMESPACE_URI, KEY_DOM_IMPLEMENTATION, KEY_XML_PARSER_CLASSNAME, KEY_XML_PARSER_VALIDATING |
Fields inherited from class org.apache.batik.transcoder.TranscoderSupport |
handler, hints |
Fields inherited from interface java.awt.print.Printable |
NO_SUCH_PAGE, PAGE_EXISTS |
Constructor Summary | |
PrintTranscoder()
Constructs a new transcoder that prints images. |
Method Summary | |
protected DocumentFactory |
createDocumentFactory(DOMImplementation domImpl,
java.lang.String parserClassname)
Creates a DocumentFactory that is used to create an SVG DOM tree. |
static void |
handleValueError(java.lang.String property,
java.lang.String value)
|
static void |
main(java.lang.String[] args)
|
void |
print()
Convenience method |
int |
print(java.awt.Graphics _g,
java.awt.print.PageFormat pageFormat,
int pageIndex)
Printable implementation |
static void |
setTranscoderBooleanHint(Transcoder transcoder,
java.lang.String property,
TranscodingHints.Key key)
|
static void |
setTranscoderFloatHint(Transcoder transcoder,
java.lang.String property,
TranscodingHints.Key key)
|
static void |
setTranscoderRectangleHint(Transcoder transcoder,
java.lang.String property,
TranscodingHints.Key key)
|
static void |
setTranscoderStringHint(Transcoder transcoder,
java.lang.String property,
TranscodingHints.Key key)
|
protected void |
transcode(Document document,
java.lang.String uri,
TranscoderOutput output)
Transcodes the specified Document as an image in the specified output. |
void |
transcode(TranscoderInput in,
TranscoderOutput out)
Transcodes the specified XML input in the specified output. |
Methods inherited from class org.apache.batik.transcoder.TranscoderSupport |
addTranscodingHint, getErrorHandler, getTranscodingHints, removeTranscodingHint, setErrorHandler, setTranscodingHints, setTranscodingHints |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.batik.transcoder.Transcoder |
addTranscodingHint, getErrorHandler, getTranscodingHints, removeTranscodingHint, setErrorHandler, setTranscodingHints, setTranscodingHints |
Field Detail |
public static final java.lang.String KEY_AOI_STR
public static final java.lang.String KEY_HEIGHT_STR
public static final java.lang.String KEY_LANGUAGE_STR
public static final java.lang.String KEY_MARGIN_BOTTOM_STR
public static final java.lang.String KEY_MARGIN_LEFT_STR
public static final java.lang.String KEY_MARGIN_RIGHT_STR
public static final java.lang.String KEY_MARGIN_TOP_STR
public static final java.lang.String KEY_PAGE_HEIGHT_STR
public static final java.lang.String KEY_PAGE_ORIENTATION_STR
public static final java.lang.String KEY_PAGE_WIDTH_STR
public static final java.lang.String KEY_PIXEL_TO_MM_STR
public static final java.lang.String KEY_SCALE_TO_PAGE_STR
public static final java.lang.String KEY_SHOW_PAGE_DIALOG_STR
public static final java.lang.String KEY_SHOW_PRINTER_DIALOG_STR
public static final java.lang.String KEY_USER_STYLESHEET_URI_STR
public static final java.lang.String KEY_WIDTH_STR
public static final java.lang.String KEY_XML_PARSER_CLASSNAME_STR
public static final java.lang.String VALUE_MEDIA_PRINT
public static final java.lang.String VALUE_PAGE_ORIENTATION_LANDSCAPE
public static final java.lang.String VALUE_PAGE_ORIENTATION_PORTRAIT
public static final java.lang.String VALUE_PAGE_ORIENTATION_REVERSE_LANDSCAPE
public static final TranscodingHints.Key KEY_WIDTH
Key: |
KEY_WIDTH |
---|---|
Value: |
Float |
Default: |
The width of the top most svg element |
Required: |
No |
Description: |
Specify the width of the image to create. |
public static final TranscodingHints.Key KEY_HEIGHT
Key: |
KEY_HEIGHT |
---|---|
Value: |
Float |
Default: |
The height of the top most svg element |
Required: |
No |
Description: |
Specify the height of the image to create. |
public static final TranscodingHints.Key KEY_AOI
Key: |
KEY_AOI |
---|---|
Value: |
Rectangle2D |
Default: |
The document's size |
Required: |
No |
Description: |
Specify the area of interest to render. The rectangle coordinates must be specified in pixels and in the document coordinates system. |
public static final TranscodingHints.Key KEY_LANGUAGE
Key: |
KEY_LANGUAGE |
---|---|
Value: |
String |
Default: |
"en" |
Required: |
No |
Description: |
Specify the preferred language of the document. |
public static final TranscodingHints.Key KEY_MEDIA
Key: |
KEY_MEDIA |
---|---|
Value: |
String |
Default: |
"print" |
Required: |
No |
Description: |
Specify the media to use with CSS. |
public static final TranscodingHints.Key KEY_USER_STYLESHEET_URI
Key: |
KEY_USER_STYLESHEET_URI |
---|---|
Value: |
String |
Default: |
null |
Required: |
No |
Description: |
Specify the user style sheet. |
public static final TranscodingHints.Key KEY_PIXEL_TO_MM
Key: |
KEY_PIXEL_TO_MM |
---|---|
Value: |
Float |
Default: |
0.33 |
Required: |
No |
Description: |
Specify the pixel to millimeter conversion factor. |
public static final TranscodingHints.Key KEY_SHOW_PAGE_DIALOG
Key: |
KEY_SHOW_PAGE_DIALOG |
---|---|
Value: |
Boolean |
Default: |
false |
Required: |
No |
Description: |
Specifies whether or not the transcoder should pop up a dialog box for selecting the page format. |
public static final TranscodingHints.Key KEY_SHOW_PRINTER_DIALOG
Key: |
KEY_SHOW_PAGE_DIALOG |
---|---|
Value: |
Boolean |
Default: |
false |
Required: |
No |
Description: |
Specifies whether or not the transcoder should pop up a dialog box for selecting the printer. If the dialog box is not shown, the transcoder will use the default printer. |
protected static final java.util.Set FEATURES
public static final TranscodingHints.Key KEY_PAGE_WIDTH
Key: |
KEY_PAGE_WIDTH |
---|---|
Value: |
Length |
Default: |
None |
Required: |
No |
Description: |
The width of the print page |
public static final TranscodingHints.Key KEY_PAGE_HEIGHT
Key: |
KEY_PAGE_HEIGHT |
---|---|
Value: |
Length |
Default: |
None |
Required: |
No |
Description: |
The height of the print page |
public static final TranscodingHints.Key KEY_MARGIN_TOP
Key: |
KEY_MARGIN_TOP |
---|---|
Value: |
Length |
Default: |
None |
Required: |
No |
Description: |
The print page top margin |
public static final TranscodingHints.Key KEY_MARGIN_RIGHT
Key: |
KEY_MARGIN_RIGHT |
---|---|
Value: |
Length |
Default: |
None |
Required: |
No |
Description: |
The print page right margin |
public static final TranscodingHints.Key KEY_MARGIN_BOTTOM
Key: |
KEY_MARGIN_BOTTOM |
---|---|
Value: |
Length |
Default: |
None |
Required: |
No |
Description: |
The print page bottom margin |
public static final TranscodingHints.Key KEY_MARGIN_LEFT
Key: |
KEY_MARGIN_LEFT |
---|---|
Value: |
Length |
Default: |
None |
Required: |
No |
Description: |
The print page left margin |
public static final TranscodingHints.Key KEY_PAGE_ORIENTATION
Key: |
KEY_PAGE_ORIENTATION |
---|---|
Value: |
String |
Default: |
VALUE_PAGE_ORIENTATION_PORTRAIT |
Required: |
No |
Description: |
The print page's orientation |
public static final TranscodingHints.Key KEY_SCALE_TO_PAGE
Key: |
KEY_SCALE_TO_PAGE |
---|---|
Value: |
Boolean |
Default: |
true |
Required: |
No |
Description: |
Specifies whether or not the SVG images are scaled to fit into the printed page |
public static final java.lang.String USAGE
Constructor Detail |
public PrintTranscoder()
Method Detail |
protected DocumentFactory createDocumentFactory(DOMImplementation domImpl, java.lang.String parserClassname)
createDocumentFactory
in class XMLAbstractTranscoder
domImpl
- the DOM Implementation (not used)parserClassname
- the XML parser classnamepublic void transcode(TranscoderInput in, TranscoderOutput out)
XMLAbstractTranscoder
transcode
in class XMLAbstractTranscoder
org.apache.batik.transcoder.XMLAbstractTranscoder
input
- the XML input to transcodeoutput
- the ouput where to transcodeTranscoderException
- if an error occured while transcodingpublic void print() throws java.awt.print.PrinterException
public int print(java.awt.Graphics _g, java.awt.print.PageFormat pageFormat, int pageIndex)
print
in interface java.awt.print.Printable
protected void transcode(Document document, java.lang.String uri, TranscoderOutput output) throws TranscoderException
transcode
in class XMLAbstractTranscoder
document
- the document to transcodeuri
- the uri of the document or null if anyoutput
- the ouput where to transcodeTranscoderException
- if an error occured while transcodingpublic static void main(java.lang.String[] args) throws java.lang.Exception
public static void setTranscoderFloatHint(Transcoder transcoder, java.lang.String property, TranscodingHints.Key key)
public static void setTranscoderRectangleHint(Transcoder transcoder, java.lang.String property, TranscodingHints.Key key)
public static void setTranscoderBooleanHint(Transcoder transcoder, java.lang.String property, TranscodingHints.Key key)
public static void setTranscoderStringHint(Transcoder transcoder, java.lang.String property, TranscodingHints.Key key)
public static void handleValueError(java.lang.String property, java.lang.String value)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |