Home
Categories
Dictionary
Download
Project Details
FAQ
License

Converter Parameters


    1  Parameters
       1.1  width
       1.2  height
       1.3  hasViewbox
       1.4  title
       1.5  insets
       1.6  allowTransformForRoot
       1.7  background
    2  Default parameters
    3  Example
    4  See also

The ConverterParameters class allows to configure the exporting of the JavaFX tree to a SVG file with the SVGConverter.

Parameters

width

The width parameter allows to set the width of the resulting svg document. If not set, by default the width will be the width of the root node bounds.

height

The height parameter allows to set the height of the resulting svg document. If not set, by default the width will be the height of the root node bounds.

hasViewbox

The hasViewbox parameter allows to set the viewbox of the resulting svg document. The viewbox will have the width and height of the svg document It is false by default.

title

The title parameter allows to add a title for the svg result. For example:
   <svg height="105.0" transform="translate(100.0 75.0)" width="105.0" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
      <title>Default Title</title>
      <defs/>
      <polyline fill="none" points="0.0,0.0 0.0,100.0 100.0,100.0 " style="stroke:rgb(255,0,0);"/>
   </svg>

insets


The insets parameter allows to add an insets around the svg result. For example with an insets of 2:
   <svg height="105.0" transform="translate(100.0 75.0)" width="105.0" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
      <defs/>
      <g transform="translate(2.0 2.0)">
         <polyline fill="none" points="0.0,0.0 0.0,100.0 100.0,100.0 " style="stroke:rgb(255,0,0);"/>
      </g>
   </svg>

allowTransformForRoot

The allowTransformForRoot parameter allows to allow transformations on the root of the svg document. It is true by default.

background

The background parameter allows to set the background color of the resulting svg document. The converter will generate a rectangle with the width and height of the svg document as the first child.

Default parameters

The SVGConverter.setDefaultParameters(ConverterParameters) method allow to set the parameters for all the subsequent calls of the converter.

Example

For example:
   ConverterParameters params = new ConverterParameters();
   params.width = 150;
   params.height = 150;      
   SVGConverter converter = new SVGConverter();
   converter.convert(<my JavaFX root>, params, <my SVG file>);

See also


Categories: Tosvg

Copyright 2021-2022 Herve Girod. All Rights Reserved. Documentation and source under the BSD-3-Clause License