Page 1 of 1

Header and footer area tree calculation exception

PostPosted: Fri Feb 23, 2018 7:39 pm
by sengseng
Hi,

I am trying to convert a DOCX file to PDF using FO-based PDF output. DOCX file and converted PDF file are attached. I am encountering problem in header/footer alignment. At the moment, what I found is the engine seems to have problem calculating the block-progression-dimension-allocated (bpda) of the block, which is giving number format exception as below:

For @bpda,
<block bap="0 0 0 0" bpd="0" ipd="468000" ipda="468000"/>
For input string: "": java.lang.NumberFormatException: For input string: ""


I traced the source code and found below snippet:

Code: Select all
Element block = (Element)region.getChildNodes().item(m);
    if (block.getLocalName().equals("block")) {
        try {
            bpda += Integer.parseInt(block.getAttribute("bpda"));
        } catch (java.lang.NumberFormatException nfe) {
            // safe to ignore?
            log.error("For @bpda, \n"+ XmlUtils.w3CDomNodeToString(block));
            log.error(nfe.getMessage(), nfe);
        }
       
    } else {
        // eg beforeFloat, mainReference, footnote
        log.debug(simplePageMasterName + " - Unexpected element: " + block.getLocalName());
}


So, the block doesn't have "bpda" attribute and the code decided to silence the number format exception of it. Is this the cause of the mis-alignment? And what can I do about it to correct the alignment?