Package org.apache.fop.area

Examples of org.apache.fop.area.RenderPagesModel


    private void parseAndRender(Source src, OutputStream out, String mime) throws Exception {
        AreaTreeParser parser = new AreaTreeParser();
               
        FOUserAgent userAgent = createUserAgent();
        FontInfo fontInfo = new FontInfo();
        AreaTreeModel treeModel = new RenderPagesModel(userAgent,
                mime, fontInfo, out);
        parser.parse(src, treeModel, userAgent);
        treeModel.endDocument();
    }
View Full Code Here


        FOUserAgent userAgent = createUserAgent();
        userAgent.setRendererOverride(renderer);
        renderer.setUserAgent(userAgent);

        FontInfo fontInfo = new FontInfo();
        AreaTreeModel treeModel = new RenderPagesModel(userAgent,
                MimeConstants.MIME_FOP_AREA_TREE, fontInfo, null);
        parser.parse(src, treeModel, userAgent);
        treeModel.endDocument();

        return (Document)domResult.getNode();
    }
View Full Code Here

            //Setup fonts and user agent
            FontInfo fontInfo = new FontInfo();
            FOUserAgent userAgent = fopFactory.newFOUserAgent();

            //Construct the AreaTreeModel that will received the individual pages
            AreaTreeModel treeModel = new RenderPagesModel(userAgent,
                    MimeConstants.MIME_PDF, fontInfo, out);

            //Iterate over all area tree files
            AreaTreeParser parser = new AreaTreeParser();
            Source src = new StreamSource(atfile);
            Source xslt = new StreamSource(stampSheet);

            //Setup Transformer for XSLT processing
            TransformerFactory tFactory = TransformerFactory.newInstance();
            Transformer transformer = tFactory.newTransformer(xslt);

            //Send XSLT result to AreaTreeParser
            SAXResult res = new SAXResult(parser.getContentHandler(treeModel, userAgent));

            //Start XSLT transformation and area tree parsing
            transformer.transform(src, res);

            //Signal the end of the processing. The renderer can finalize the target document.
            treeModel.endDocument();
        } finally {
            out.close();
        }
    }
View Full Code Here

            //Setup fonts and user agent
            FontInfo fontInfo = new FontInfo();
            FOUserAgent userAgent = fopFactory.newFOUserAgent();

            //Construct the AreaTreeModel that will received the individual pages
            AreaTreeModel treeModel = new RenderPagesModel(userAgent,
                    MimeConstants.MIME_PDF, fontInfo, out);

            //Iterate over all area tree files
            AreaTreeParser parser = new AreaTreeParser();
            for (int i = 0; i < files.length; i++) {
                Source src = new StreamSource(files[i]);
                parser.parse(src, treeModel, userAgent);
            }

            //Signal the end of the processing. The renderer can finalize the target document.
            treeModel.endDocument();
        } finally {
            out.close();
        }
    }
View Full Code Here

    /** {@inheritDoc} */
    public void renderTo(FOUserAgent userAgent, String outputFormat, OutputStream out)
                throws FOPException {
        FontInfo fontInfo = new FontInfo();
        AreaTreeModel treeModel = new RenderPagesModel(userAgent,
                outputFormat, fontInfo, out);
       
        //Iterate over all intermediate files
        AreaTreeParser parser = new AreaTreeParser();
       
        // Resulting SAX events (the generated FO) must be piped through to FOP
        Result res = new SAXResult(parser.getContentHandler(treeModel, userAgent));

        transformTo(res);
       
        try {
            treeModel.endDocument();
        } catch (SAXException e) {
            throw new FOPException(e);
        }
    }
View Full Code Here

            //Setup fonts and user agent
            FontInfo fontInfo = new FontInfo();
            FOUserAgent userAgent = fopFactory.newFOUserAgent();

            //Construct the AreaTreeModel that will received the individual pages
            AreaTreeModel treeModel = new RenderPagesModel(userAgent,
                    MimeConstants.MIME_PDF, fontInfo, out);
           
            //Iterate over all intermediate files
            AreaTreeParser parser = new AreaTreeParser();
            Source src = new StreamSource(atfile);
            Source xslt = new StreamSource(stampSheet);
           
            //Setup Transformer for XSLT processing
            TransformerFactory tFactory = TransformerFactory.newInstance();
            Transformer transformer = tFactory.newTransformer(xslt);
           
            //Send XSLT result to AreaTreeParser
            SAXResult res = new SAXResult(parser.getContentHandler(treeModel, userAgent));
           
            //Start XSLT transformation and area tree parsing
            transformer.transform(src, res);
           
            //Signal the end of the processing. The renderer can finalize the target document.
            treeModel.endDocument();
        } finally {
            out.close();
        }
    }
View Full Code Here

            //Setup fonts and user agent
            FontInfo fontInfo = new FontInfo();
            FOUserAgent userAgent = fopFactory.newFOUserAgent();

            //Construct the AreaTreeModel that will received the individual pages
            AreaTreeModel treeModel = new RenderPagesModel(userAgent,
                    MimeConstants.MIME_PDF, fontInfo, out);
           
            //Iterate over all intermediate files
            AreaTreeParser parser = new AreaTreeParser();
            for (int i = 0; i < files.length; i++) {
                Source src = new StreamSource(files[i]);
                parser.parse(src, treeModel, userAgent);
            }
           
            //Signal the end of the processing. The renderer can finalize the target document.
            treeModel.endDocument();
        } finally {
            out.close();
        }
    }
View Full Code Here

    private void parseAndRender(Source src, OutputStream out, String mime) throws Exception {
        AreaTreeParser parser = new AreaTreeParser();
               
        FOUserAgent userAgent = createUserAgent();
        FontInfo fontInfo = new FontInfo();
        AreaTreeModel treeModel = new RenderPagesModel(userAgent,
                mime, fontInfo, out);
        parser.parse(src, treeModel, userAgent);
        treeModel.endDocument();
    }
View Full Code Here

        FOUserAgent userAgent = createUserAgent();
        userAgent.setRendererOverride(renderer);
        renderer.setUserAgent(userAgent);

        FontInfo fontInfo = new FontInfo();
        AreaTreeModel treeModel = new RenderPagesModel(userAgent,
                MimeConstants.MIME_FOP_AREA_TREE, fontInfo, null);
        parser.parse(src, treeModel, userAgent);
        treeModel.endDocument();

        return (Document)domResult.getNode();
    }
View Full Code Here

            ifRenderer.setDocumentHandler(serializer);

            ua.setRendererOverride(ifRenderer);
            FontInfo fontInfo = new FontInfo();
            //Construct the AreaTreeModel that will received the individual pages
            final AreaTreeModel treeModel = new RenderPagesModel(ua,
                    null, fontInfo, null);

            //Iterate over all intermediate files
            AreaTreeParser parser = new AreaTreeParser();
            ContentHandler handler = parser.getContentHandler(treeModel, ua);

            DelegatingContentHandler proxy = new DelegatingContentHandler() {

                public void endDocument() throws SAXException {
                    super.endDocument();
                    //Signal the end of the processing.
                    //The renderer can finalize the target document.
                    treeModel.endDocument();
                }

            };
            proxy.setDelegateContentHandler(handler);
View Full Code Here

TOP

Related Classes of org.apache.fop.area.RenderPagesModel

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.