Class RenderPagesModel

java.lang.Object
org.apache.fop.area.AreaTreeModel
org.apache.fop.area.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 Details

    • renderer

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

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

    • RenderPagesModel

      public RenderPagesModel(FOUserAgent userAgent, String outputFormat, FontInfo fontInfo, 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 Details

    • setDocumentLocale

      public void setDocumentLocale(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
    • handleOffDocumentItem

      public void handleOffDocumentItem(OffDocumentItem oDI)
      Handle an OffDocumentItem
      Overrides:
      handleOffDocumentItem in class AreaTreeModel
      Parameters:
      oDI - the extension to handle
    • endDocument

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