public class Main extends Object implements SVGConverterController
SVGConverter
and rasterizer images. OptionHandler
which
is responsible for converting the option into a configuration of the
SVGConverter
which is used to perform the conversion.Modifier and Type | Class and Description |
---|---|
static class |
Main.AbstractOptionHandler
This abstract implementation of the
OptionHandler interface
throws an exception if the number of arguments passed to the
handleOption method does not match the number of expected
optionValues. |
static class |
Main.ColorOptionHandler
Base class for options which expect a
Color optionValue. |
static class |
Main.FloatOptionHandler
Base class for options which expect the single optionValue to
be a float.
|
static class |
Main.NoValueOptionHandler
Base class for options with no option value (i.e., the presence
of the option means something in itself.
|
static interface |
Main.OptionHandler
Interface for handling one command line option
|
static class |
Main.RectangleOptionHandler
Base class for options which expect a
Rectangle optionValue. |
static class |
Main.SingleValueOptionHandler
Base class for options with a single option value.
|
static class |
Main.TimeOptionHandler
Base class for options which expect the single optionValue to
be a time value.
|
Modifier and Type | Field and Description |
---|---|
protected List |
args
List of arguments describing the conversion task to be
performed.
|
static String |
CL_OPTION_ALLOWED_SCRIPTS
Option to specify the set of allowed scripts
|
static String |
CL_OPTION_ALLOWED_SCRIPTS_DESCRIPTION |
static String |
CL_OPTION_ALTERNATE_STYLESHEET
Option to specify the CSS alternate stylesheet when
converting the SVG images
|
static String |
CL_OPTION_ALTERNATE_STYLESHEET_DESCRIPTION |
static String |
CL_OPTION_AOI
Option to specify the area of interest in the output
image.
|
static String |
CL_OPTION_AOI_DESCRIPTION |
static String |
CL_OPTION_BACKGROUND_COLOR
Option to specify the output image's background color
|
static String |
CL_OPTION_BACKGROUND_COLOR_DESCRIPTION |
static String |
CL_OPTION_BLOCK_EXTERNAL_RESOURCES |
static String |
CL_OPTION_BLOCK_EXTERNAL_RESOURCES_DESCRIPTION |
static String |
CL_OPTION_CONSTRAIN_SCRIPT_ORIGIN
Option to determine whether scripts a constrained to the
same origin as the document referencing them.
|
static String |
CL_OPTION_CONSTRAIN_SCRIPT_ORIGIN_DESCRIPTION |
static String |
CL_OPTION_DEFAULT_FONT_FAMILY
Option to specify the default value for the font-family
CSS property when converting the SVG image
|
static String |
CL_OPTION_DEFAULT_FONT_FAMILY_DESCRIPTION |
static String |
CL_OPTION_DPI
Option to specify the resolution for the output image
|
static String |
CL_OPTION_DPI_DESCRIPTION |
static String |
CL_OPTION_HEIGHT
Option to specify the output image's height
|
static String |
CL_OPTION_HEIGHT_DESCRIPTION |
static String |
CL_OPTION_INDEXED
Option to specify if the PNG should be indexed.
|
static String |
CL_OPTION_INDEXED_DESCRIPTION |
static String |
CL_OPTION_LANGUAGE
Option to specify the user language with which SVG
documents should be processed
|
static String |
CL_OPTION_LANGUAGE_DESCRIPTION |
static String |
CL_OPTION_MAX_HEIGHT
Option to specify the output image's maximum height.
|
static String |
CL_OPTION_MAX_HEIGHT_DESCRIPTION |
static String |
CL_OPTION_MAX_WIDTH
Option to specify the output image's maximum width.
|
static String |
CL_OPTION_MAX_WIDTH_DESCRIPTION |
static String |
CL_OPTION_MEDIA_TYPE
Option to specify the CSS media type when converting
the SVG image
|
static String |
CL_OPTION_MEDIA_TYPE_DESCRIPTION |
static String |
CL_OPTION_MIME_TYPE
Option to specify the output image's mime type
|
static String |
CL_OPTION_MIME_TYPE_DESCRIPTION |
static String |
CL_OPTION_ONLOAD
Option to specify that the converted SVG files should
be after the dispatch of the 'onload' event.
|
static String |
CL_OPTION_ONLOAD_DESCRIPTION |
static String |
CL_OPTION_OUTPUT
Option to specify the output directory or file
|
static String |
CL_OPTION_OUTPUT_DESCRIPTION |
static String |
CL_OPTION_QUALITY
Option to specify the output JPEG quality
|
static String |
CL_OPTION_QUALITY_DESCRIPTION |
static String |
CL_OPTION_SECURITY_OFF
Option to turn off secure execution of scripts
|
static String |
CL_OPTION_SECURITY_OFF_DESCRIPTION |
static String |
CL_OPTION_SNAPSHOT_TIME
Option to specify that the document should be rasterized after
seeking to the specified document time.
|
static String |
CL_OPTION_SNAPSHOT_TIME_DESCRIPTION |
static String |
CL_OPTION_USER_STYLESHEET
Option to specify an addition user stylesheet
|
static String |
CL_OPTION_USER_STYLESHEET_DESCRIPTION |
static String |
CL_OPTION_VALIDATE
Option to specify that the converted SVG files should
be validated during the conversion process.
|
static String |
CL_OPTION_VALIDATE_DESCRIPTION |
static String |
CL_OPTION_WIDTH
Option to specify the output image's width
|
static String |
CL_OPTION_WIDTH_DESCRIPTION |
static String |
ERROR_ILLEGAL_ARGUMENT
Error when an illegal option value was passed to the app
{0} Option
{1} Option description
|
static String |
ERROR_NOT_ENOUGH_OPTION_VALUES
Error when there are missing option values:
{0} Option
{1} Option description
|
static String |
ERROR_WHILE_CONVERTING_FILES |
static String |
MESSAGE_ABOUT_TO_TRANSCODE |
static String |
MESSAGE_ABOUT_TO_TRANSCODE_SOURCE |
static String |
MESSAGE_CONVERSION_FAILED |
static String |
MESSAGE_CONVERSION_SUCCESS |
protected static Map |
mimeTypeMap
Static map containing all the mime types understood by the
rasterizer
|
protected static Map |
optionMap
Static map containing all the option handlers able to analyze the
various options.
|
static String |
RASTERIZER_SECURITY_POLICY
URL for Squiggle's security policy file
|
static String |
USAGE
Describes the command line options for the rasterizer
|
Modifier and Type | Method and Description |
---|---|
protected void |
error(String errorCode,
Object[] errorArgs) |
void |
execute() |
protected String[] |
expandSources(List sources)
Scans the input vector and replaces directories with the list
of SVG files they contain
|
static void |
main(String[] args) |
void |
onSourceTranscodingSuccess(SVGConverterSource source,
File dest)
Invoked when the rasterizer successfully transcoded
the input source.
|
boolean |
proceedOnSourceTranscodingFailure(SVGConverterSource source,
File dest,
String errorCode)
Invoked when the rasterizer got an error while
transcoding the input source.
|
boolean |
proceedWithComputedTask(Transcoder transcoder,
Map hints,
List sources,
List dest)
Invoked when the rasterizer has computed the
exact description of what it should do.
|
boolean |
proceedWithSourceTranscoding(SVGConverterSource source,
File dest)
Invoked when the rasterizer is about to start transcoding
of a given source.
|
protected String |
toString(String[] v) |
void |
validateConverterConfig(SVGConverter c)
Template methods which subclasses may implement to do whatever is
needed.
|
public static final String RASTERIZER_SECURITY_POLICY
public static String USAGE
public static String CL_OPTION_OUTPUT
public static String CL_OPTION_OUTPUT_DESCRIPTION
public static String CL_OPTION_MIME_TYPE
public static String CL_OPTION_MIME_TYPE_DESCRIPTION
public static String CL_OPTION_WIDTH
public static String CL_OPTION_WIDTH_DESCRIPTION
public static String CL_OPTION_HEIGHT
public static String CL_OPTION_HEIGHT_DESCRIPTION
public static String CL_OPTION_MAX_WIDTH
public static String CL_OPTION_MAX_WIDTH_DESCRIPTION
public static String CL_OPTION_MAX_HEIGHT
public static String CL_OPTION_MAX_HEIGHT_DESCRIPTION
public static String CL_OPTION_AOI
public static String CL_OPTION_AOI_DESCRIPTION
public static String CL_OPTION_BACKGROUND_COLOR
public static String CL_OPTION_BACKGROUND_COLOR_DESCRIPTION
public static String CL_OPTION_MEDIA_TYPE
public static String CL_OPTION_MEDIA_TYPE_DESCRIPTION
public static String CL_OPTION_DEFAULT_FONT_FAMILY
public static String CL_OPTION_DEFAULT_FONT_FAMILY_DESCRIPTION
public static String CL_OPTION_ALTERNATE_STYLESHEET
public static String CL_OPTION_ALTERNATE_STYLESHEET_DESCRIPTION
public static String CL_OPTION_VALIDATE
public static String CL_OPTION_VALIDATE_DESCRIPTION
public static String CL_OPTION_ONLOAD
public static String CL_OPTION_ONLOAD_DESCRIPTION
public static String CL_OPTION_SNAPSHOT_TIME
public static String CL_OPTION_SNAPSHOT_TIME_DESCRIPTION
public static String CL_OPTION_LANGUAGE
public static String CL_OPTION_LANGUAGE_DESCRIPTION
public static String CL_OPTION_USER_STYLESHEET
public static String CL_OPTION_USER_STYLESHEET_DESCRIPTION
public static String CL_OPTION_DPI
public static String CL_OPTION_DPI_DESCRIPTION
public static String CL_OPTION_QUALITY
public static String CL_OPTION_QUALITY_DESCRIPTION
public static String CL_OPTION_INDEXED
public static String CL_OPTION_INDEXED_DESCRIPTION
public static String CL_OPTION_ALLOWED_SCRIPTS
public static String CL_OPTION_ALLOWED_SCRIPTS_DESCRIPTION
public static String CL_OPTION_CONSTRAIN_SCRIPT_ORIGIN
public static String CL_OPTION_CONSTRAIN_SCRIPT_ORIGIN_DESCRIPTION
public static String CL_OPTION_BLOCK_EXTERNAL_RESOURCES
public static String CL_OPTION_BLOCK_EXTERNAL_RESOURCES_DESCRIPTION
public static String CL_OPTION_SECURITY_OFF
public static String CL_OPTION_SECURITY_OFF_DESCRIPTION
protected static Map optionMap
protected static Map mimeTypeMap
protected List args
public static final String ERROR_NOT_ENOUGH_OPTION_VALUES
public static final String ERROR_ILLEGAL_ARGUMENT
public static final String ERROR_WHILE_CONVERTING_FILES
public static final String MESSAGE_ABOUT_TO_TRANSCODE
public static final String MESSAGE_ABOUT_TO_TRANSCODE_SOURCE
public static final String MESSAGE_CONVERSION_FAILED
public static final String MESSAGE_CONVERSION_SUCCESS
public Main(String[] args)
public void execute()
public void validateConverterConfig(SVGConverter c)
protected String[] expandSources(List sources)
public static void main(String[] args)
public boolean proceedWithComputedTask(Transcoder transcoder, Map hints, List sources, List dest)
SVGConverterController
proceedWithComputedTask
in interface SVGConverterController
transcoder
- Transcoder which will be usedhints
- set of hints that were set on the transcodersources
- list of SVG sources it will convert.dest
- list of destination file it will usepublic boolean proceedWithSourceTranscoding(SVGConverterSource source, File dest)
SVGConverterController
proceedWithSourceTranscoding
in interface SVGConverterController
public boolean proceedOnSourceTranscodingFailure(SVGConverterSource source, File dest, String errorCode)
SVGConverterController
proceedOnSourceTranscodingFailure
in interface SVGConverterController
errorCode
- see the SVGConverter
error code descriptions.public void onSourceTranscodingSuccess(SVGConverterSource source, File dest)
SVGConverterController
onSourceTranscodingSuccess
in interface SVGConverterController
Copyright © 2000–2023 Apache Software Foundation. All rights reserved.