Class PrintTranscoder

All Implemented Interfaces:
Printable, Transcoder

public class PrintTranscoder extends SVGAbstractTranscoder implements Printable
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:
  • KEY_LANGUAGE, KEY_USER_STYLESHEET_URI, KEY_PIXEL_TO_MM, KEY_XML_PARSER_CLASSNAME can be used to set the defaults for the various SVG properties.
  • KEY_PAGE_WIDTH, KEY_PAGE_HEIGHT, KEY_MARGIN_TOP, KEY_MARGIN_BOTTOM, KEY_MARGIN_LEFT, KEY_MARGIN_RIGHT and KEY_PAGE_ORIENTATION can be used to specify the printing page characteristics.
  • KEY_WIDTH, KEY_HEIGHT can be used to specify how to scale the SVG image
  • KEY_SCALE_TO_PAGE can be used to specify whether or not the SVG image should be scaled uniformly to fit into the printed page or if it should just be centered into the printed page.
Version:
$Id: PrintTranscoder.java 1808001 2017-09-11 09:51:29Z ssteiner $
  • Field Details

    • KEY_AOI_STR

      public static final String KEY_AOI_STR
      See Also:
    • KEY_HEIGHT_STR

      public static final String KEY_HEIGHT_STR
      See Also:
    • KEY_LANGUAGE_STR

      public static final String KEY_LANGUAGE_STR
      See Also:
    • KEY_MARGIN_BOTTOM_STR

      public static final String KEY_MARGIN_BOTTOM_STR
      See Also:
    • KEY_MARGIN_LEFT_STR

      public static final String KEY_MARGIN_LEFT_STR
      See Also:
    • KEY_MARGIN_RIGHT_STR

      public static final String KEY_MARGIN_RIGHT_STR
      See Also:
    • KEY_MARGIN_TOP_STR

      public static final String KEY_MARGIN_TOP_STR
      See Also:
    • KEY_PAGE_HEIGHT_STR

      public static final String KEY_PAGE_HEIGHT_STR
      See Also:
    • KEY_PAGE_ORIENTATION_STR

      public static final String KEY_PAGE_ORIENTATION_STR
      See Also:
    • KEY_PAGE_WIDTH_STR

      public static final String KEY_PAGE_WIDTH_STR
      See Also:
    • KEY_PIXEL_TO_MM_STR

      public static final String KEY_PIXEL_TO_MM_STR
      See Also:
    • KEY_SCALE_TO_PAGE_STR

      public static final String KEY_SCALE_TO_PAGE_STR
      See Also:
    • KEY_SHOW_PAGE_DIALOG_STR

      public static final String KEY_SHOW_PAGE_DIALOG_STR
      See Also:
    • KEY_SHOW_PRINTER_DIALOG_STR

      public static final String KEY_SHOW_PRINTER_DIALOG_STR
      See Also:
    • KEY_USER_STYLESHEET_URI_STR

      public static final String KEY_USER_STYLESHEET_URI_STR
      See Also:
    • KEY_WIDTH_STR

      public static final String KEY_WIDTH_STR
      See Also:
    • KEY_XML_PARSER_CLASSNAME_STR

      public static final String KEY_XML_PARSER_CLASSNAME_STR
      See Also:
    • VALUE_MEDIA_PRINT

      public static final String VALUE_MEDIA_PRINT
      See Also:
    • VALUE_PAGE_ORIENTATION_LANDSCAPE

      public static final String VALUE_PAGE_ORIENTATION_LANDSCAPE
      See Also:
    • VALUE_PAGE_ORIENTATION_PORTRAIT

      public static final String VALUE_PAGE_ORIENTATION_PORTRAIT
      See Also:
    • VALUE_PAGE_ORIENTATION_REVERSE_LANDSCAPE

      public static final String VALUE_PAGE_ORIENTATION_REVERSE_LANDSCAPE
      See Also:
    • inputs

      private List inputs
      Set of inputs this transcoder has been requested to transcode so far. Purpose is not really clear: some data is added, and it is copied into printedInputs. But it is never read or cleared...
    • printedInputs

      private List printedInputs
      Currently printing set of pages. This vector is created as a clone of inputs when the first page is printed.
    • curIndex

      private int curIndex
      Index of the page corresponding to root
    • theCtx

      private BridgeContext theCtx
      Place to cache BridgeContext so we can dispose of it when it is appropriate. The Baseclass would dispose of it too soon.
    • KEY_SHOW_PAGE_DIALOG

      public static final TranscodingHints.Key KEY_SHOW_PAGE_DIALOG
      The showPageDialog key.
      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.
    • KEY_SHOW_PRINTER_DIALOG

      public static final TranscodingHints.Key KEY_SHOW_PRINTER_DIALOG
      The showPrinterDialog key.
      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.
    • KEY_PAGE_WIDTH

      public static final TranscodingHints.Key KEY_PAGE_WIDTH
      The pageWidth key.
      Key: KEY_PAGE_WIDTH
      Value: Length
      Default: None
      Required: No
      Description: The width of the print page
    • KEY_PAGE_HEIGHT

      public static final TranscodingHints.Key KEY_PAGE_HEIGHT
      The pageHeight key.
      Key: KEY_PAGE_HEIGHT
      Value: Length
      Default: none
      Required: No
      Description: The height of the print page
    • KEY_MARGIN_TOP

      public static final TranscodingHints.Key KEY_MARGIN_TOP
      The marginTop key.
      Key: KEY_MARGIN_TOP
      Value: Length
      Default: None
      Required: No
      Description: The print page top margin
    • KEY_MARGIN_RIGHT

      public static final TranscodingHints.Key KEY_MARGIN_RIGHT
      The marginRight key.
      Key: KEY_MARGIN_RIGHT
      Value: Length
      Default: None
      Required: No
      Description: The print page right margin
    • KEY_MARGIN_BOTTOM

      public static final TranscodingHints.Key KEY_MARGIN_BOTTOM
      The marginBottom key.
      Key: KEY_MARGIN_BOTTOM
      Value: Length
      Default: None
      Required: No
      Description: The print page bottom margin
    • KEY_MARGIN_LEFT

      public static final TranscodingHints.Key KEY_MARGIN_LEFT
      The marginLeft key.
      Key: KEY_MARGIN_LEFT
      Value: Length
      Default: None
      Required: No
      Description: The print page left margin
    • KEY_PAGE_ORIENTATION

      public static final TranscodingHints.Key KEY_PAGE_ORIENTATION
      The pageOrientation key.
      Key: KEY_PAGE_ORIENTATION
      Value: String
      Default: VALUE_PAGE_ORIENTATION_PORTRAIT
      Required: No
      Description: The print page's orientation
    • KEY_SCALE_TO_PAGE

      public static final TranscodingHints.Key KEY_SCALE_TO_PAGE
      The scaleToPage key.
      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
    • USAGE

      public static final String USAGE
      See Also:
  • Constructor Details

    • PrintTranscoder

      public PrintTranscoder()
      Constructs a new transcoder that prints images.
  • Method Details