Package org.apache.fop.apps

Examples of org.apache.fop.apps.FOUserAgent$FOPEventBroadcaster


       
        Transformer transformer = replicatorTemplates.newTransformer();
        transformer.setParameter("repeats", new Integer(replicatorRepeats));
       
        OutputStream out = new NullOutputStream(); //write to /dev/nul
        FOUserAgent userAgent = fopFactory.newFOUserAgent();
        userAgent.setBaseURL(foFile.getParentFile().toURL().toExternalForm());
        Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out);
        Result res = new SAXResult(fop.getDefaultHandler());
       
        transformer.transform(src, res);
       
View Full Code Here


        return buffer.toString();
    }

    private void renderPDF(String fo, String digestIn, String digestOut)
        throws Exception {
        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
        foUserAgent.setCreationDate(new Date(10000));
        MessageDigest outDigest = MessageDigest.getInstance("MD5");
        DigestOutputStream out =
            new DigestOutputStream(new ByteArrayOutputStream(), outDigest);
        Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
        InputSource source = new InputSource(new StringReader(fo));
View Full Code Here

    protected void convertFO() throws Exception {
        final File baseDir = getBaseDir();
        final String fontFOFilePath = getFontFOFilePath();
        File foFile = new File(baseDir, fontFOFilePath);
        final boolean dumpOutput = false;
        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
        convertFO(foFile, foUserAgent, dumpOutput);
    }
View Full Code Here

    }

    /** {@inheritDoc} */
    public void process(InputStream in, Templates templates, OutputStream out)
                throws org.apache.fop.apps.FOPException, java.io.IOException {
        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
        Fop fop = fopFactory.newFop(this.mime, foUserAgent, out);

        try {
            Transformer transformer;
            if (templates == null) {
View Full Code Here

    /**
     * Tests Fop with JAXP and OutputStream generating PDF.
     * @throws Exception if anything fails
     */
    public void testFO2PDFWithJAXP() throws Exception {
        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
        File foFile = new File(getBaseDir(), "test/xml/bugtests/block.fo");
        ByteArrayOutputStream baout = new ByteArrayOutputStream();
        Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, baout);
       
        TransformerFactory factory = TransformerFactory.newInstance();
View Full Code Here

    /**
     * Tests Fop with JAXP and OutputStream generating PostScript.
     * @throws Exception if anything fails
     */
    public void testFO2PSWithJAXP() throws Exception {
        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
        File foFile = new File(getBaseDir(), "test/xml/bugtests/block.fo");
        ByteArrayOutputStream baout = new ByteArrayOutputStream();
        Fop fop = fopFactory.newFop(MimeConstants.MIME_POSTSCRIPT, foUserAgent, baout);
       
        TransformerFactory factory = TransformerFactory.newInstance();
View Full Code Here

    /**
     * Tests Fop with JAXP and OutputStream generating RTF.
     * @throws Exception if anything fails
     */
    public void testFO2RTFWithJAXP() throws Exception {
        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
        File foFile = new File(getBaseDir(), "test/xml/bugtests/block.fo");
        ByteArrayOutputStream baout = new ByteArrayOutputStream();
        Fop fop = fopFactory.newFop(MimeConstants.MIME_RTF, foUserAgent, baout);
       
        TransformerFactory factory = TransformerFactory.newInstance();
View Full Code Here

    /**
     * Tests Fop with XsltInputHandler and OutputStream.
     * @throws Exception if anything fails
     */
    public void testFO2PDFWithXSLTInputHandler() throws Exception {
        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
        File xmlFile = new File(getBaseDir(), "test/xml/1.xml");
        File xsltFile = new File(getBaseDir(), "test/xsl/doc.xsl");
        ByteArrayOutputStream baout = new ByteArrayOutputStream();
       
        InputHandler handler = new InputHandler(xmlFile, xsltFile, null);
View Full Code Here

    /** create an FOUserAgent for our tests
     *  @return an initialized FOUserAgent
     * */
    protected FOUserAgent getUserAgent() {
        final FOUserAgent a = fopFactory.newFOUserAgent();
        a.getRendererOptions().put("pdf-a-mode", "PDF/A-1b");
        return a;
    }
View Full Code Here

    /**
     * Test exception when PDF/A-1 is enabled together with encryption.
     * @throws Exception if the test fails
     */
    public void testNoEncryption() throws Exception {
        final FOUserAgent ua = getUserAgent();
        ua.getRendererOptions().put("owner-password", "mypassword"); //To enabled encryption
        File foFile = new File(foBaseDir, "minimal-pdf-a.fo");
        try {
            convertFO(foFile, ua, dumpPDF);
            fail("Expected PDFConformanceException. PDF/A-1 and PDF encryption don't go together.");
        } catch (PDFConformanceException e) {
View Full Code Here

TOP

Related Classes of org.apache.fop.apps.FOUserAgent$FOPEventBroadcaster

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.