Class Main
java.lang.Object
org.apache.batik.apps.rasterizer.Main
- All Implemented Interfaces:
SVGConverterController
Handles command line parameters to configure the
Each command line option is handled by an
SVGConverter
and rasterizer images. Each command line option is handled by an
OptionHandler which
is responsible for converting the option into a configuration of the
SVGConverter which is used to perform the conversion.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis abstract implementation of theOptionHandlerinterface throws an exception if the number of arguments passed to thehandleOptionmethod does not match the number of expected optionValues.static classBase class for options which expect aColoroptionValue.static classBase class for options which expect the single optionValue to be a float.static classBase class for options with no option value (i.e., the presence of the option means something in itself.static interfaceInterface for handling one command line optionstatic classBase class for options which expect aRectangleoptionValue.static classBase class for options with a single option value.static classBase class for options which expect the single optionValue to be a time value. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ListList of arguments describing the conversion task to be performed.static Stringstatic Stringstatic StringOption to specify the set of allowed scriptsstatic Stringstatic StringOption to specify the CSS alternate stylesheet when converting the SVG imagesstatic Stringstatic StringOption to specify the area of interest in the output image.static Stringstatic StringOption to specify the output image's background colorstatic Stringstatic StringOption to determine whether scripts a constrained to the same origin as the document referencing them.static Stringstatic StringOption to specify the default value for the font-family CSS property when converting the SVG imagestatic Stringstatic StringOption to specify the resolution for the output imagestatic Stringstatic StringOption to specify the output image's heightstatic Stringstatic StringOption to specify if the PNG should be indexed.static Stringstatic StringOption to specify the user language with which SVG documents should be processedstatic Stringstatic StringOption to specify the output image's maximum height.static Stringstatic StringOption to specify the output image's maximum width.static Stringstatic StringOption to specify the CSS media type when converting the SVG imagestatic Stringstatic StringOption to specify the output image's mime typestatic Stringstatic StringOption to specify that the converted SVG files should be after the dispatch of the 'onload' event.static Stringstatic StringOption to specify the output directory or filestatic Stringstatic StringOption to specify the output JPEG qualitystatic Stringstatic StringOption to turn off secure execution of scriptsstatic Stringstatic StringOption to specify that the document should be rasterized after seeking to the specified document time.static Stringstatic StringOption to specify an addition user stylesheetstatic Stringstatic StringOption to specify that the converted SVG files should be validated during the conversion process.static Stringstatic StringOption to specify the output image's widthstatic Stringstatic final StringError when an illegal option value was passed to the app {0} Option {1} Option descriptionstatic final StringError when there are missing option values: {0} Option {1} Option descriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected static MapStatic map containing all the mime types understood by the rasterizerprotected static MapStatic map containing all the option handlers able to analyze the various options.static final StringURL for Squiggle's security policy filestatic StringDescribes the command line options for the rasterizer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidvoidexecute()protected String[]expandSources(List sources) Scans the input vector and replaces directories with the list of SVG files they containstatic voidvoidonSourceTranscodingSuccess(SVGConverterSource source, File dest) Invoked when the rasterizer successfully transcoded the input source.booleanproceedOnSourceTranscodingFailure(SVGConverterSource source, File dest, String errorCode) Invoked when the rasterizer got an error while transcoding the input source.booleanproceedWithComputedTask(Transcoder transcoder, Map hints, List sources, List dest) Invoked when the rasterizer has computed the exact description of what it should do.booleanproceedWithSourceTranscoding(SVGConverterSource source, File dest) Invoked when the rasterizer is about to start transcoding of a given source.protected StringvoidTemplate methods which subclasses may implement to do whatever is needed.
-
Field Details
-
RASTERIZER_SECURITY_POLICY
URL for Squiggle's security policy file- See Also:
-
USAGE
Describes the command line options for the rasterizer -
CL_OPTION_OUTPUT
Option to specify the output directory or file -
CL_OPTION_OUTPUT_DESCRIPTION
-
CL_OPTION_MIME_TYPE
Option to specify the output image's mime type -
CL_OPTION_MIME_TYPE_DESCRIPTION
-
CL_OPTION_WIDTH
Option to specify the output image's width -
CL_OPTION_WIDTH_DESCRIPTION
-
CL_OPTION_HEIGHT
Option to specify the output image's height -
CL_OPTION_HEIGHT_DESCRIPTION
-
CL_OPTION_MAX_WIDTH
Option to specify the output image's maximum width. -
CL_OPTION_MAX_WIDTH_DESCRIPTION
-
CL_OPTION_MAX_HEIGHT
Option to specify the output image's maximum height. -
CL_OPTION_MAX_HEIGHT_DESCRIPTION
-
CL_OPTION_AOI
Option to specify the area of interest in the output image. -
CL_OPTION_AOI_DESCRIPTION
-
CL_OPTION_BACKGROUND_COLOR
Option to specify the output image's background color -
CL_OPTION_BACKGROUND_COLOR_DESCRIPTION
-
CL_OPTION_MEDIA_TYPE
Option to specify the CSS media type when converting the SVG image -
CL_OPTION_MEDIA_TYPE_DESCRIPTION
-
CL_OPTION_DEFAULT_FONT_FAMILY
Option to specify the default value for the font-family CSS property when converting the SVG image -
CL_OPTION_DEFAULT_FONT_FAMILY_DESCRIPTION
-
CL_OPTION_ALTERNATE_STYLESHEET
Option to specify the CSS alternate stylesheet when converting the SVG images -
CL_OPTION_ALTERNATE_STYLESHEET_DESCRIPTION
-
CL_OPTION_VALIDATE
Option to specify that the converted SVG files should be validated during the conversion process. -
CL_OPTION_VALIDATE_DESCRIPTION
-
CL_OPTION_ONLOAD
Option to specify that the converted SVG files should be after the dispatch of the 'onload' event. -
CL_OPTION_ONLOAD_DESCRIPTION
-
CL_OPTION_SNAPSHOT_TIME
Option to specify that the document should be rasterized after seeking to the specified document time. -
CL_OPTION_SNAPSHOT_TIME_DESCRIPTION
-
CL_OPTION_LANGUAGE
Option to specify the user language with which SVG documents should be processed -
CL_OPTION_LANGUAGE_DESCRIPTION
-
CL_OPTION_USER_STYLESHEET
Option to specify an addition user stylesheet -
CL_OPTION_USER_STYLESHEET_DESCRIPTION
-
CL_OPTION_DPI
Option to specify the resolution for the output image -
CL_OPTION_DPI_DESCRIPTION
-
CL_OPTION_QUALITY
Option to specify the output JPEG quality -
CL_OPTION_QUALITY_DESCRIPTION
-
CL_OPTION_INDEXED
Option to specify if the PNG should be indexed. -
CL_OPTION_INDEXED_DESCRIPTION
-
CL_OPTION_ALLOWED_SCRIPTS
Option to specify the set of allowed scripts -
CL_OPTION_ALLOWED_SCRIPTS_DESCRIPTION
-
CL_OPTION_CONSTRAIN_SCRIPT_ORIGIN
Option to determine whether scripts a constrained to the same origin as the document referencing them. -
CL_OPTION_CONSTRAIN_SCRIPT_ORIGIN_DESCRIPTION
-
CL_OPTION_ALLOW_EXTERNAL_RESOURCES
-
CL_OPTION_ALLOW_EXTERNAL_RESOURCES_DESCRIPTION
-
CL_OPTION_SECURITY_OFF
Option to turn off secure execution of scripts -
CL_OPTION_SECURITY_OFF_DESCRIPTION
-
optionMap
Static map containing all the option handlers able to analyze the various options. -
mimeTypeMap
Static map containing all the mime types understood by the rasterizer -
args
List of arguments describing the conversion task to be performed. -
ERROR_NOT_ENOUGH_OPTION_VALUES
Error when there are missing option values: {0} Option {1} Option description- See Also:
-
ERROR_ILLEGAL_ARGUMENT
Error when an illegal option value was passed to the app {0} Option {1} Option description- See Also:
-
ERROR_WHILE_CONVERTING_FILES
- See Also:
-
MESSAGE_ABOUT_TO_TRANSCODE
- See Also:
-
MESSAGE_ABOUT_TO_TRANSCODE_SOURCE
- See Also:
-
MESSAGE_CONVERSION_FAILED
- See Also:
-
MESSAGE_CONVERSION_SUCCESS
- See Also:
-
-
Constructor Details
-
Main
-
-
Method Details
-
error
-
execute
public void execute() -
toString
-
validateConverterConfig
Template methods which subclasses may implement to do whatever is needed. For example, this can be used for test purposes. -
expandSources
-
main
-
proceedWithComputedTask
Description copied from interface:SVGConverterControllerInvoked when the rasterizer has computed the exact description of what it should do. The controller should return true if the transcoding process should proceed or false otherwise.- Specified by:
proceedWithComputedTaskin interfaceSVGConverterController- Parameters:
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 use
-
proceedWithSourceTranscoding
Description copied from interface:SVGConverterControllerInvoked when the rasterizer is about to start transcoding of a given source. The controller should return true if the source should be transcoded and false otherwise.- Specified by:
proceedWithSourceTranscodingin interfaceSVGConverterController
-
proceedOnSourceTranscodingFailure
public boolean proceedOnSourceTranscodingFailure(SVGConverterSource source, File dest, String errorCode) Description copied from interface:SVGConverterControllerInvoked when the rasterizer got an error while transcoding the input source. The controller should return true if the transcoding process should continue on other sources and it should return false if it should not.- Specified by:
proceedOnSourceTranscodingFailurein interfaceSVGConverterController- Parameters:
errorCode- see theSVGConvertererror code descriptions.
-
onSourceTranscodingSuccess
Description copied from interface:SVGConverterControllerInvoked when the rasterizer successfully transcoded the input source.- Specified by:
onSourceTranscodingSuccessin interfaceSVGConverterController
-