Package org.apache.batik.transcoder

Examples of org.apache.batik.transcoder.TranscoderInput


        trans.transform(source, result);
    }

    public static void svgToJPEG(File svg, File jpeg) throws IOException, TranscoderException {
        // Create the transcoder input.
        TranscoderInput input = new TranscoderInput(svg.toURI().toString());
        // Create the transcoder output.
        OutputStream ostream = new FileOutputStream(jpeg);
        TranscoderOutput output = new TranscoderOutput(ostream);

        // Create a JPEG transcoder
View Full Code Here


        ostream.close();
    }

    public static void svgToJPEG(Document svg, File jpeg) throws IOException, TranscoderException {
        // Create the transcoder input.
        TranscoderInput input = new TranscoderInput(svg);
        // Create the transcoder output.
        OutputStream ostream = new FileOutputStream(jpeg);
        TranscoderOutput output = new TranscoderOutput(ostream);

        // Create a JPEG transcoder
View Full Code Here

        ostream.close();
    }

    public static void svgToJPEG(InputStream svg, OutputStream jpeg) throws IOException, TranscoderException {
        // Create the transcoder input.
        TranscoderInput input = new TranscoderInput(svg);

        TranscoderOutput output = new TranscoderOutput(jpeg);

        // Create a JPEG transcoder
        Transcoder t = new JPEGTranscoder();
View Full Code Here

        jpeg.close();
    }

    public static void svgToPNG(InputStream svg, OutputStream png) throws IOException, TranscoderException {
        // Create the transcoder input.
        TranscoderInput input = new TranscoderInput(svg);

        TranscoderOutput output = new TranscoderOutput(png);

        // Create a JPEG transcoder
        Transcoder t = new PNGTranscoder();
View Full Code Here

     * Receive notification of a successfully completed DOM tree generation.
     */
    public void notify(Document doc) throws SAXException {
       
        try {
            TranscoderInput transInput = new TranscoderInput(doc);

            // Buffering is done by the pipeline (See shouldSetContentLength)
            TranscoderOutput transOutput = new TranscoderOutput(this.output);
            transcoder.transcode(transInput, transOutput);
        } catch (TranscoderException ex) {
View Full Code Here

     */
    protected void transcode(SVGConverterSource inputFile,
                             File outputFile,
                             Transcoder transcoder)
        throws SVGConverterException {
        TranscoderInput input = null;
        TranscoderOutput output = null;
        OutputStream outputStream = null;

        if (!controller.proceedWithSourceTranscoding(inputFile,
                                                     outputFile)){
            return;
        }

        try {
            if (inputFile.isSameAs(outputFile.getPath())) {
                throw new SVGConverterException(ERROR_SOURCE_SAME_AS_DESTINATION,
                                                 true /* fatal error */);
            }
           
            // Compute transcoder input.
            if (!inputFile.isReadable()) {
                throw new SVGConverterException(ERROR_CANNOT_READ_SOURCE,
                                                 new Object[]{inputFile.getName()});
            }

            try {
                InputStream in = inputFile.openStream();
                in.close();
            } catch(IOException ioe) {
                throw new SVGConverterException(ERROR_CANNOT_OPEN_SOURCE,
                                                 new Object[] {inputFile.getName(),
                                                               ioe.toString()});
                                                               }
           
            input = new TranscoderInput(inputFile.getURI());

            // Compute transcoder output.
            if (!isWriteable(outputFile)) {
                throw new SVGConverterException(ERROR_OUTPUT_NOT_WRITEABLE,
                                                 new Object[] {outputFile.getName()});
View Full Code Here

                                              Boolean.TRUE);

                        //
                        // Do transcoding now
                        //
                        pt.transcode(new TranscoderInput(uri), null);

                        //
                        // Print
                        //
                        try {
View Full Code Here

        //
        // First, request the transcoder to transcode
        // each of the input files
        //
        for(int i=0; i<args.length; i++){
            transcoder.transcode(new TranscoderInput(new File(args[i]).toURL().toString()),
                                 null);
        }

        //
        // Now, print...
View Full Code Here

            report.setPassed(false);
            return report;
        }

        ImageTranscoder transcoder = getTestImageTranscoder();
        TranscoderInput src = new TranscoderInput(svgURL.toString());
        TranscoderOutput dst = new TranscoderOutput(tmpFileOS);
       
        try{
            transcoder.transcode(src, dst);
        }catch(TranscoderException e){
View Full Code Here

    /**
     * Helper method: creates a valid reference image
     */
    public static URL createValidReferenceImage(String svgContent) throws Exception{
        TranscoderInput validSrc = new TranscoderInput(new StringReader(svgContent));
       
        File tmpFile = File.createTempFile(SVGRenderingAccuracyTest.TEMP_FILE_PREFIX,
                                           SVGRenderingAccuracyTest.TEMP_FILE_SUFFIX);
       
        TranscoderOutput validDst
View Full Code Here

TOP

Related Classes of org.apache.batik.transcoder.TranscoderInput

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.