Class FOPAreaTreeHelper

java.lang.Object
org.docx4j.convert.out.fo.FOPAreaTreeHelper

public class FOPAreaTreeHelper extends Object
Helper to correctly size header/footer areas in PDF output.
Since:
3.1.0
  • Field Details

    • log

      protected static org.slf4j.Logger log
  • Constructor Details

    • FOPAreaTreeHelper

      public FOPAreaTreeHelper()
  • Method Details

    • trimContent

      static void trimContent(WordprocessingMLPackage hfPkg)
      Since we start with headers/footers which each take up approx half the page, there is little room for the body content (which would result in many pages, and unnecessary processing). At the same time, we need enough body content to produce first page, odd page, and even page for each section. So this method replaces the existing body content with content which is sufficient for our needs. This method isn't essential, but it should make things faster. It leaves the headers/footers untouched, since it is those which we're most interested in at this point.
      Parameters:
      hfPkg -
    • createFillerP

      private static P createFillerP()
    • getAreaTreeViaFOP

      static Document getAreaTreeViaFOP(WordprocessingMLPackage hfPkg, boolean useXSLT, FOSettings foSettingsOverall) throws Docx4JException, ParserConfigurationException, SAXException, IOException
      Throws:
      Docx4JException
      ParserConfigurationException
      SAXException
      IOException
    • calculateHFExtents

      static void calculateHFExtents(Document areaTree, Map<String,Integer> headerBpda, Map<String,Integer> footerBpda)
      The area tree contains the information required to calculate how tall each header and footer should be. The method performs the calculation (summing block/@bpda) for each region.
      Parameters:
      areaTree -
      headerBpda -
      footerBpda -
    • adjustLayoutMasterSet

      static void adjustLayoutMasterSet(org.plutext.jaxb.xslfo.LayoutMasterSet layoutMasterSet, ConversionSectionWrappers conversionSectionWrappers, Map<String,Integer> headerBpda, Map<String,Integer> footerBpda)
      Inject the calculated heights for each header and footer, and adjust the region body margins to fit them.
      Parameters:
      layoutMasterSet -
      headerBpda -
      footerBpda -