Class RenderPagesModel

  • Direct Known Subclasses:
    CachedRenderPagesModel

    public class RenderPagesModel
    extends AreaTreeModel
    This uses the AreaTreeModel to store the pages Each page is either rendered if ready or prepared for later rendering. Once a page is rendered it is cleared to release the contents but the PageViewport is retained. So even though the pages are stored the contents are discarded.
    • Field Detail

      • renderer

        protected Renderer renderer
        The renderer that will render the pages.
      • prepared

        protected java.util.List<PageViewport> prepared
        Pages that have been prepared but not rendered yet.
    • Constructor Detail

      • RenderPagesModel

        public RenderPagesModel​(FOUserAgent userAgent,
                                java.lang.String outputFormat,
                                FontInfo fontInfo,
                                java.io.OutputStream stream)
                         throws FOPException
        Create a new render pages model with the given renderer.
        Parameters:
        userAgent - FOUserAgent object for process
        outputFormat - the MIME type of the output format to use (ex. "application/pdf").
        fontInfo - FontInfo object
        stream - OutputStream
        Throws:
        FOPException - if the renderer cannot be properly initialized
    • Method Detail

      • setDocumentLocale

        public void setDocumentLocale​(java.util.Locale locale)
        Overrides:
        setDocumentLocale in class AreaTreeModel
        Parameters:
        locale - The locale of the document
      • startPageSequence

        public void startPageSequence​(PageSequence pageSequence)
        Start a page sequence on this model.
        Overrides:
        startPageSequence in class AreaTreeModel
        Parameters:
        pageSequence - the page sequence about to start
      • addPage

        public void addPage​(PageViewport page)
        Add a page to the render page model. If the page is finished it can be rendered immediately. If the page needs resolving then if the renderer supports out of order rendering it can prepare the page. Otherwise the page is added to a queue.
        Overrides:
        addPage in class AreaTreeModel
        Parameters:
        page - the page to add to the model
      • checkPreparedPages

        protected boolean checkPreparedPages​(PageViewport newPageViewport,
                                             boolean renderUnresolved)
        Check prepared pages
        Parameters:
        newPageViewport - the new page being added
        renderUnresolved - render pages with unresolved idref's (done at end-of-document processing)
        Returns:
        true if the current page should be rendered false if the renderer doesn't support out of order rendering and there are pending pages
      • renderPage

        protected void renderPage​(PageViewport pageViewport)
        Renders the given page and notified about unresolved IDs if any.
        Parameters:
        pageViewport - the page to be rendered.
      • preparePage

        protected void preparePage​(PageViewport page)
        Prepare a page. An unresolved page can be prepared if the renderer supports it and the page will be rendered later.
        Parameters:
        page - the page to prepare
      • processOffDocumentItems

        private void processOffDocumentItems​(java.util.List<OffDocumentItem> list)
      • endDocument

        public void endDocument()
                         throws org.xml.sax.SAXException
        End the document. Render any end document OffDocumentItems Signal the end of the document for any processing.
        Overrides:
        endDocument in class AreaTreeModel
        Throws:
        org.xml.sax.SAXException - if a problem was encountered.