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

How to use
Transcoder
in
org.apache.batik.transcoder

Best Java code snippets using org.apache.batik.transcoder.Transcoder (Showing top 20 results out of 405)

origin: stackoverflow.com

 import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import org.apache.batik.transcoder.Transcoder;
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.fop.svg.PDFTranscoder;

public class Test {
  public static void main(String[] argv) throws TranscoderException, FileNotFoundException {
    Transcoder transcoder = new PDFTranscoder();
    TranscoderInput transcoderInput = new TranscoderInput(new FileInputStream(new File("/tmp/test.svg")));
    TranscoderOutput transcoderOutput = new TranscoderOutput(new FileOutputStream(new File("/tmp/test.pdf")));
    transcoder.transcode(transcoderInput, transcoderOutput);
  }
}
origin: apache/batik

public void handleOption() {
  index++;
  transcoder.addTranscodingHint(SVGTranscoder.KEY_FORMAT, Boolean.FALSE);
}
origin: elki-project/elki

/**
 * Transcode a document into a file using the given transcoder.
 *
 * @param file Output file
 * @param transcoder Transcoder to use
 * @throws IOException On write errors
 * @throws TranscoderException On input/parsing errors
 */
protected void transcode(File file, Transcoder transcoder) throws IOException, TranscoderException {
 // Disable validation, performance is more important here (thumbnails!)
 transcoder.addTranscodingHint(XMLAbstractTranscoder.KEY_XML_PARSER_VALIDATING, Boolean.FALSE);
 SVGDocument doc = cloneDocument();
 TranscoderInput input = new TranscoderInput(doc);
 OutputStream out = new BufferedOutputStream(new FileOutputStream(file));
 TranscoderOutput output = new TranscoderOutput(out);
 transcoder.transcode(input, output);
 out.flush();
 out.close();
}
origin: apache/batik

transcoder.setTranscodingHints(hints);
origin: de.lmu.ifi.dbs.elki/elki-batik-visualization

/**
 * Transcode a document into a file using the given transcoder.
 *
 * @param file Output file
 * @param transcoder Transcoder to use
 * @throws IOException On write errors
 * @throws TranscoderException On input/parsing errors
 */
protected void transcode(File file, Transcoder transcoder) throws IOException, TranscoderException {
 // Disable validation, performance is more important here (thumbnails!)
 transcoder.addTranscodingHint(XMLAbstractTranscoder.KEY_XML_PARSER_VALIDATING, Boolean.FALSE);
 SVGDocument doc = cloneDocument();
 TranscoderInput input = new TranscoderInput(doc);
 OutputStream out = new BufferedOutputStream(new FileOutputStream(file));
 TranscoderOutput output = new TranscoderOutput(out);
 transcoder.transcode(input, output);
 out.flush();
 out.close();
}
origin: org.apache.xmlgraphics/batik-svgrasterizer

transcoder.setTranscodingHints(hints);
origin: fr.avianey.apache-xmlgraphics/batik

public void handleOption() {
  index++;
  transcoder.addTranscodingHint(SVGTranscoder.KEY_FORMAT, Boolean.FALSE);
}
origin: com.arsframework/ars-core

/**
 * 将SVG输入流转换并写入到JPEG输出流
 *
 * @param reader SVG字符流
 * @param output JPEG输出流
 * @throws TranscoderException 转换异常
 */
public static void svg2jpeg(Reader reader, OutputStream output) throws TranscoderException {
  if (reader == null) {
    throw new IllegalArgumentException("Reader must not be null");
  }
  if (output == null) {
    throw new IllegalArgumentException("OutputStream must not be null");
  }
  Transcoder transcoder = new JPEGTranscoder();
  transcoder.transcode(new TranscoderInput(reader), new TranscoderOutput(output));
}
origin: net.sourceforge.ondex.apps/ovtk2

/**
 * Transcodes the image using the transcoder specified
 * 
 * @param t
 * @param svgGenerator
 * @param useCSS
 * @param rect
 * @param fos
 * @throws IOException
 * @throws TranscoderException
 */
public static void transcode(Transcoder t, SVGGraphics2D svgGenerator, boolean useCSS, Rectangle rect, FileOutputStream fos) throws IOException, TranscoderException {
  PipedWriter pout = new PipedWriter();
  BufferedReader rin = new BufferedReader(new PipedReader(pout));
  new Piper(svgGenerator, useCSS, pout).start();
  t.addTranscodingHint(JPEGTranscoder.KEY_HEIGHT, Float.valueOf(rect.height));
  t.addTranscodingHint(JPEGTranscoder.KEY_WIDTH, Float.valueOf(rect.width));
  t.transcode(new TranscoderInput(rin), new TranscoderOutput(fos));
}
origin: fr.avianey.apache-xmlgraphics/batik

transcoder.setTranscodingHints(hints);
origin: apache/batik

public void handleOption() {
  index++;
  if (index >= arguments.length) {
    throw new IllegalArgumentException();
  }
  String s = arguments[index++];
  transcoder.addTranscodingHint(SVGTranscoder.KEY_XML_DECLARATION, s);
}
origin: com.arsframework/ars-core

/**
 * 将SVG输入流转换并写入到JPEG输出流
 *
 * @param input  SVG输入流
 * @param output JPEG输出流
 * @throws TranscoderException 转换异常
 */
public static void svg2jpeg(InputStream input, OutputStream output) throws TranscoderException {
  if (input == null) {
    throw new IllegalArgumentException("InputStream must not be null");
  }
  if (output == null) {
    throw new IllegalArgumentException("OutputStream must not be null");
  }
  Transcoder transcoder = new JPEGTranscoder();
  transcoder.transcode(new TranscoderInput(input), new TranscoderOutput(output));
}
origin: stackoverflow.com

  transcoder.addTranscodingHint(PNGTranscoder.KEY_BACKGROUND_COLOR, Color.WHITE);
} else {
  transcoder = new JPEGTranscoder();
  transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, jpegQuality);
  transcoder.transcode(transcoderInput, transcoderOutput);
origin: fr.avianey.apache-xmlgraphics/batik

public void handleOption() {
  index++;
  if (index >= arguments.length) {
    throw new IllegalArgumentException();
  }
  String s = arguments[index++];
  transcoder.addTranscodingHint(SVGTranscoder.KEY_XML_DECLARATION, s);
}
origin: com.arsframework/ars-core

/**
 * 将SVG输入流转换并写入到PNG输出流
 *
 * @param reader SVG字符流
 * @param output PNG输出流
 * @throws TranscoderException 转换异常
 */
public static void svg2png(Reader reader, OutputStream output) throws TranscoderException {
  if (reader == null) {
    throw new IllegalArgumentException("Reader must not be null");
  }
  if (output == null) {
    throw new IllegalArgumentException("OutputStream must not be null");
  }
  Transcoder transcoder = new PNGTranscoder();
  transcoder.transcode(new TranscoderInput(reader), new TranscoderOutput(output));
}
origin: fr.avianey.apache-xmlgraphics/batik

public void handleOption() {
  index++;
  if (index >= arguments.length) {
    throw new IllegalArgumentException();
  }
  String s = arguments[index++];
  transcoder.addTranscodingHint(SVGTranscoder.KEY_PUBLIC_ID, s);
}
origin: com.arsframework/ars-core

/**
 * 将SVG输入流转换并写入到PNG输出流
 *
 * @param input  SVG输入流
 * @param output PNG输出流
 * @throws TranscoderException 转换异常
 */
public static void svg2png(InputStream input, OutputStream output) throws TranscoderException {
  if (input == null) {
    throw new IllegalArgumentException("InputStream must not be null");
  }
  if (output == null) {
    throw new IllegalArgumentException("OutputStream must not be null");
  }
  Transcoder transcoder = new PNGTranscoder();
  transcoder.transcode(new TranscoderInput(input), new TranscoderOutput(output));
}
origin: fr.avianey.apache-xmlgraphics/batik

public static void setTranscoderStringHint(Transcoder transcoder,
                     String property,
                     TranscodingHints.Key key){
  String str = System.getProperty(property);
  if(str != null){
    transcoder.addTranscodingHint(key, str);
  }
}
origin: com.arsframework/ars-core

/**
 * 将SVG输入流转换并写入到PDF输出流
 *
 * @param reader SVG字符流
 * @param output PDF输出流
 * @throws TranscoderException 转换异常
 */
public static void svg2pdf(Reader reader, OutputStream output) throws TranscoderException {
  if (reader == null) {
    throw new IllegalArgumentException("Reader must not be null");
  }
  if (output == null) {
    throw new IllegalArgumentException("OutputStream must not be null");
  }
  Transcoder transcoder = new PDFTranscoder();
  transcoder.transcode(new TranscoderInput(reader), new TranscoderOutput(output));
}
origin: fr.avianey.apache-xmlgraphics/batik

public void handleOption() {
  index++;
  if (index >= arguments.length) {
    throw new IllegalArgumentException();
  }
  String s = arguments[index++];
  transcoder.addTranscodingHint(SVGTranscoder.KEY_SYSTEM_ID, s);
}
org.apache.batik.transcoderTranscoder

Javadoc

This class defines an API for transcoding.

Most used methods

  • transcode
    Transcodes the specified input in the specified output.
  • addTranscodingHint
    Sets the value of a single preference for the transcoding process.
  • setTranscodingHints
    Sets the values of all preferences for the transcoding algorithms with the specified hints.

Popular in Java

  • Start an intent from android
  • startActivity (Activity)
  • getSharedPreferences (Context)
  • findViewById (Activity)
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Permission (java.security)
    Legacy security code; do not use.
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • JTable (javax.swing)
  • Top Vim 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