Package org.apache.fop.cli

Examples of org.apache.fop.cli.InputHandler


                baseURL = xmlFile.getParentFile().toURL().toExternalForm();
            } catch (Exception e) {
                logger.error("Error setting base directory");
            }

            InputHandler inputHandler = null;
            if (xsl == null) {
                inputHandler = new InputHandler(xmlFile);
            } else {
                inputHandler = new InputHandler(xmlFile,
                                                new File(baseDir + "/"
                                                         + xsl), null);
            }

            FOUserAgent userAgent = new FOUserAgent();
            userAgent.setBaseURL(baseURL);
            Fop fop = new Fop(outputFormat, userAgent);

            userAgent.getRendererOptions().put("fineDetail", new Boolean(false));
            userAgent.getRendererOptions().put("consistentOutput", new Boolean(true));
            userAgent.setProducer("Testsuite Converter");

            String outname = res;
            if (outname.endsWith(".xml") || outname.endsWith(".pdf")) {
                outname = outname.substring(0, outname.length() - 4);
            }
            File outputFile = new File(destdir,
                                       outname + makeResultExtension());

            outputFile.getParentFile().mkdirs();
            OutputStream outStream = new java.io.BufferedOutputStream(
                                 new java.io.FileOutputStream(outputFile));
            fop.setOutputStream(outStream);
            logger.debug("ddir:" + destdir + " on:" + outputFile.getName());
            inputHandler.render(fop);
            outStream.close();

            // check difference
            if (compare != null) {
                File f1 = new File(destdir, outname + ".at.xml");
View Full Code Here


        File xsltFile = new File(getBaseDir(), "test/xsl/doc.xsl");
        ByteArrayOutputStream baout = new ByteArrayOutputStream();
        Fop fop = new Fop(MimeConstants.MIME_PDF);
        fop.setOutputStream(baout);
       
        InputHandler handler = new InputHandler(xmlFile, xsltFile, null);
        handler.render(fop);
       
        assertTrue("Generated PDF has zero length", baout.size() > 0);
    }
View Full Code Here

TOP

Related Classes of org.apache.fop.cli.InputHandler

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.