congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
SVGConverter
Code IndexAdd Tabnine to your IDE (free)

How to use
SVGConverter
in
org.apache.batik.apps.rasterizer

Best Java code snippets using org.apache.batik.apps.rasterizer.SVGConverter (Showing top 19 results out of 315)

origin: org.apache.xmlgraphics/batik-svgrasterizer

public void handleOption(String optionValue,
             SVGConverter c){
  DestinationType dstType =
    (DestinationType)mimeTypeMap.get(optionValue);
  if (dstType == null){
    throw new IllegalArgumentException();
  }
  c.setDestinationType(dstType);
}
origin: org.apache.xmlgraphics/batik-svgrasterizer

public void handleOption(String optionValue,
             SVGConverter c){
  c.setDst(new File(optionValue));
}
public String getOptionDescription(){
origin: fr.avianey.apache-xmlgraphics/batik

public void handleOption(float optionValue,
             SVGConverter c){
  if (optionValue <= 0){
    throw new IllegalArgumentException();
  }
  c.setHeight(optionValue);
}
origin: com.xpn.xwiki.platform/xwiki-core

public byte[] getSVGImage(int hashCode, String content, String extension, int height, int width) throws IOException, SVGConverterException {
   File dfile = getTempFile(hashCode, "svg");
   if (!dfile.exists()) {
     FileWriter fwriter = new FileWriter(dfile);
     fwriter.write(content);
     fwriter.flush();
     fwriter.close();
   }
  File ofile = getTempFile(hashCode, extension);
  //TODO implement conversion HERE
  
  SVGConverter conv = new SVGConverter();
  // TODO PNG ONLY
  conv.setDestinationType(DestinationType.PNG);
  conv.setDst(ofile);
  conv.setHeight(height);
  conv.setWidth(width);
  String[] sources = {dfile.getAbsolutePath()};
  conv.setSources(sources);
  conv.execute();
  
  FileInputStream fis = new FileInputStream(ofile);
  byte[] result = new byte[(int)ofile.length()];
  fis.read(result);
  return result;
}

origin: org.apache.xmlgraphics/batik-svgrasterizer

List sources = computeSources();
if(sources.size() == 1 && dst != null && isFile(dst)){
  dstFiles = new ArrayList();
  dstFiles.add(dst);
  dstFiles = computeDstFiles(sources);
Map hints = computeTranscodingHints();
transcoder.setTranscodingHints(hints);
  File outputFile  = (File)dstFiles.get(i);
  createOutputDir(outputFile);
  transcode(currentFile, outputFile, transcoder);
origin: org.apache.xmlgraphics/batik-svgrasterizer

public void execute(){
  SVGConverter c = new SVGConverter(this);
                    RASTERIZER_SECURITY_POLICY);
  securityEnforcer.enforceSecurity(!c.getSecurityOff());
  c.setSources(expandedSources);
    c.execute();
  } catch(SVGConverterException e){
    error(ERROR_WHILE_CONVERTING_FILES,
origin: fr.avianey.apache-xmlgraphics/batik

public void handleOption(float optionValue,
             SVGConverter c){
  if (optionValue <= 0){
    throw new IllegalArgumentException();
  }
  c.setWidth(optionValue);
}
origin: fr.avianey.apache-xmlgraphics/batik

List sources = computeSources();
if(sources.size() == 1 && dst != null && isFile(dst)){
  dstFiles = new ArrayList();
  dstFiles.add(dst);
  dstFiles = computeDstFiles(sources);
Map hints = computeTranscodingHints();
transcoder.setTranscodingHints(hints);
  File outputFile  = (File)dstFiles.get(i);
  createOutputDir(outputFile);
  transcode(currentFile, outputFile, transcoder);
origin: fr.avianey.apache-xmlgraphics/batik

public void execute(){
  SVGConverter c = new SVGConverter(this);
                    RASTERIZER_SECURITY_POLICY);
  securityEnforcer.enforceSecurity(!c.getSecurityOff());
  c.setSources(expandedSources);
    c.execute();
  } catch(SVGConverterException e){
    error(ERROR_WHILE_CONVERTING_FILES,
origin: org.apache.xmlgraphics/batik-svgrasterizer

public void handleOption(float optionValue,
             SVGConverter c){
  if (optionValue <= 0){
    throw new IllegalArgumentException();
  }
  c.setWidth(optionValue);
}
origin: apache/batik

List sources = computeSources();
if(sources.size() == 1 && dst != null && isFile(dst)){
  dstFiles = new ArrayList();
  dstFiles.add(dst);
  dstFiles = computeDstFiles(sources);
Map hints = computeTranscodingHints();
transcoder.setTranscodingHints(hints);
  File outputFile  = (File)dstFiles.get(i);
  createOutputDir(outputFile);
  transcode(currentFile, outputFile, transcoder);
origin: apache/batik

public void execute(){
  SVGConverter c = new SVGConverter(this);
                    RASTERIZER_SECURITY_POLICY);
  securityEnforcer.enforceSecurity(!c.getSecurityOff());
  c.setSources(expandedSources);
    c.execute();
  } catch(SVGConverterException e){
    error(ERROR_WHILE_CONVERTING_FILES,
origin: fr.avianey.apache-xmlgraphics/batik

public void handleOption(String optionValue,
             SVGConverter c){
  c.setDst(new File(optionValue));
}
public String getOptionDescription(){
origin: org.apache.xmlgraphics/batik-svgrasterizer

public void handleOption(float optionValue,
             SVGConverter c){
  if (optionValue <= 0){
    throw new IllegalArgumentException();
  }
  c.setHeight(optionValue);
}
origin: apache/batik

public void handleOption(float optionValue,
             SVGConverter c){
  if (optionValue <= 0){
    throw new IllegalArgumentException();
  }
  c.setWidth(optionValue);
}
origin: fr.avianey.apache-xmlgraphics/batik

public void handleOption(String optionValue,
             SVGConverter c){
  DestinationType dstType =
    (DestinationType)mimeTypeMap.get(optionValue);
  if (dstType == null){
    throw new IllegalArgumentException();
  }
  c.setDestinationType(dstType);
}
origin: apache/batik

public void handleOption(String optionValue,
             SVGConverter c){
  c.setDst(new File(optionValue));
}
public String getOptionDescription(){
origin: apache/batik

public void handleOption(float optionValue,
             SVGConverter c){
  if (optionValue <= 0){
    throw new IllegalArgumentException();
  }
  c.setHeight(optionValue);
}
origin: apache/batik

public void handleOption(String optionValue,
             SVGConverter c){
  DestinationType dstType =
    (DestinationType)mimeTypeMap.get(optionValue);
  if (dstType == null){
    throw new IllegalArgumentException();
  }
  c.setDestinationType(dstType);
}
org.apache.batik.apps.rasterizerSVGConverter

Javadoc

This application can be used to convert SVG images to raster images.
Possible result raster image formats are PNG, JPEG, TIFF, and PDF. The Batik Transcoder API is used to execute the conversion. FOP is needed to be able to transcode to the PDF format
The source has to be list of files or URL (set by the setSources method).
The destination can be:
  • unspecified. In that case, only file sources can be converted and a file in the same directory as the source will be created.
  • a directory, set by the setDst method. In that case, the output files are created in that destination directory
  • a file. In case there is a single source, the destination can be a single named file (set with the setDst method.)

There are a number of options which control the way the image is converted to the destination format:
  • destinationType: controls the type of conversion which should be done. see the DestinationType documentation.
  • width/height: they control the desired width and height, in user space, for the output image.
  • maxWidth/maxHeight: control the maximum width and height, in user space, of the output image.
  • area: controls the specific sub-area of the image which should be rendered.
  • backgroundColor: controls the color which is used to fill the background before rendering the image
  • quality: relevant only for JPEG destinations, this controls the encoding quality.
  • indexed: relevant only for PNG, controls the number of bits used in writting of a palletized files.
  • mediaType: controls the CSS media, or list of media, for which the image should be rendered.
  • alternate: controls the alternate CSS stylesheet to activate, if any.
  • language: controls the user language with which the SVG document should be converted.
  • userStylesheet: defines the user stylesheet to apply to SVG documents in addition to other stylesheets referenced by or embedded in the SVG documents.
  • pixelUnitToMillimeter: defines the size of a pixel in millimeters to use when processing the SVG documents.

Most used methods

  • <init>
  • execute
    Starts the conversion process.
  • setDestinationType
    Sets the destinationType attribute value. Should not be null.
  • setDst
    When converting a single source, dst can be a file. Othewise, it should be a directory.
  • setHeight
    In less than or equal to zero, the height is not constrained on the output image. The height is in u
  • setSources
    Sets the list of individual SVG sources. The strings can be either URLs or file names. Note that inv
  • setWidth
    In less than or equal to zero, the width is not constrained on the output image. The width is in use
  • computeDstFiles
    Populates a vector with destination files names computed from the names of the files in the sources
  • computeSources
    Populates a vector with the set of SVG files from the srcDir if it is not null and with the sources
  • computeTranscodingHints
    Computes the set of transcoding hints to use for the operation
  • createOutputDir
    Creates directories for output files if needed.
  • getDestinationFile
    Get the name of the result image file.This method modifies the result filename, it changes the exist
  • createOutputDir,
  • getDestinationFile,
  • getFileNRef,
  • getSecurityOff,
  • isFile,
  • isWriteable,
  • setAllowedScriptTypes,
  • setAlternateStylesheet,
  • setArea,
  • setBackgroundColor

Popular in Java

  • Reading from database using SQL prepared statement
  • setContentView (Activity)
  • getSystemService (Context)
  • findViewById (Activity)
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • JPanel (javax.swing)
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now