Examples of Fop


Examples of org.apache.fop.apps.Fop

        renderer.setContentHandler(handler);
        renderer.setUserAgent(userAgent);

        userAgent.setRendererOverride(renderer);
       
        Fop fop = fopFactory.newFop(MimeConstants.MIME_FOP_AREA_TREE, userAgent);
        Result res = new SAXResult(fop.getDefaultHandler());
        transformer.transform(src, res);
       
        return (Document)domResult.getNode();
    }
View Full Code Here

Examples of org.apache.fop.apps.Fop

     * @throws Exception if the conversion fails
     */
    protected byte[] convertFO(File foFile, FOUserAgent ua, boolean dumpPdfFile)
            throws Exception {
        ByteArrayOutputStream baout = new ByteArrayOutputStream();
        Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, ua, baout);
        Transformer transformer = tFactory.newTransformer();
        Source src = new StreamSource(foFile);
        SAXResult res = new SAXResult(fop.getDefaultHandler());
        transformer.transform(src, res);
        final byte[] result = baout.toByteArray();
        if (dumpPdfFile) {
            final File outFile = new File(foFile.getParentFile(), foFile.getName() + ".pdf");
            FileUtils.writeByteArrayToFile(outFile, result);
View Full Code Here

Examples of org.apache.fop.apps.Fop

        //Setup output
        ByteArrayOutputStream out = new ByteArrayOutputStream();

        //Setup FOP
        Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);

        //Make sure the XSL transformation's result is piped through to FOP
        Result res = new SAXResult(fop.getDefaultHandler());

        //Start the transformation and rendering process
        transformer.transform(src, res);

        //Return the result
View Full Code Here

Examples of org.apache.fop.apps.Fop

            }

            Result res = null;
            try
            {
                Fop fop = FOP_FACTORY.newFop( MimeConstants.MIME_PDF, userAgent, out );
                res = new SAXResult( fop.getDefaultHandler() );
            }
            catch ( FOPException e )
            {
                throw new TransformerException( e );
            }
View Full Code Here

Examples of org.apache.fop.apps.Fop

            StreamSource src = new StreamSource(new StringReader(writer.toString()));

            // create the output stream for the generation
            ByteArrayOutputStream baos = new ByteArrayOutputStream();

            Fop fop = ApacheFopWorker.createFopInstance(baos, MimeConstants.MIME_PDF);
            ApacheFopWorker.transform(src, null, fop);

            baos.flush();
            baos.close();
View Full Code Here

Examples of org.apache.fop.apps.Fop

            StreamSource src = new StreamSource(new StringReader(writer.toString()));

            // create the output stream for the generation
            ByteArrayOutputStream baos = new ByteArrayOutputStream();

            Fop fop = ApacheFopWorker.createFopInstance(baos, MimeConstants.MIME_PDF);
            ApacheFopWorker.transform(src, null, fop);

            baos.flush();
            baos.close();
View Full Code Here

Examples of org.apache.fop.apps.Fop

                StreamSource src = new StreamSource(new StringReader(writer.toString()));

                // create the output stream for the generation
                ByteArrayOutputStream baos = new ByteArrayOutputStream();

                Fop fop = ApacheFopWorker.createFopInstance(baos, MimeConstants.MIME_PDF);
                ApacheFopWorker.transform(src, null, fop);

                // and generate the PDF
                baos.flush();
                baos.close();
View Full Code Here

Examples of org.apache.fop.apps.Fop

                    StreamSource src = new StreamSource(new StringReader(writer.toString()));

                    // create the output stream for the generation
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();

                    Fop fop = ApacheFopWorker.createFopInstance(baos, MimeConstants.MIME_PDF);
                    ApacheFopWorker.transform(src, null, fop);

                    // and generate the PDF
                    baos.flush();
                    baos.close();
View Full Code Here

Examples of org.apache.fop.apps.Fop

    FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    // transform xml
    Transformer xslfoTransformer = getTransformer(transformSource);
    try {
      Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, outStream);
      Result res = new SAXResult(fop.getDefaultHandler());
      xslfoTransformer.transform(source, res);
    } catch (FOPException e) {
      throw new IOException("FOPException occurred", e);
    } catch (TransformerException e) {
      throw new IOException("TransformerException occurred", e);
View Full Code Here

Examples of org.apache.fop.apps.Fop

    FopFactory fopFactory = FopFactory.newInstance();
    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    // transform xml
    try {
      Transformer xslfoTransformer = TransformerFactory.newInstance().newTransformer(transformSource);
      Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, outStream);
      Result res = new SAXResult(fop.getDefaultHandler());
      xslfoTransformer.transform(source, res);
    } catch (FOPException e) {
      throw new IOException("FOPException occurred", e);
    } catch (TransformerException e) {
      throw new IOException("TransformerException occurred", e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.