2016-07-01 26 views
1

我想通過外部圖形覆蓋文本塊,我能夠做到這一點,但每當在圖像上呈現文本塊時我都會看到此錯誤:在Apache中的圖像覆蓋文本FOP

org.apache.fop.layoutmgr.table.TableCellLayoutManager:getContentAreaBPD呼籲未知BPD

我試圖爲表芯,塊容器和模塊,但沒有幫助建立高度。

<fo:table-cell display-align="center" height="229px"> 
      <fo:block> 
       <fo:block-container z-index="1" top="0px" left="0px"> 
        <fo:block height="229px" absolute-position="absolute"> 
         <fo:external-graphic scaling="non-uniform" src=url("http://previews.123rf.com/images/nujalee/nujalee1108/nujalee110800004/10410227-Beautiful-green-leaf-isolated-on-white-Stock-Photo-leaf-texture.jpg") content-height="229px" content-width="110px"/> 
        </fo:block> 
       </fo:block-container> 
       <fo:block-container z-index="2" background-color="#538000" height="20px" width="77px" bottom="-229px" right="0px" absolute-position="absolute"> 
        <fo:block color="#333333" font-size="10px" height="20px" font-family="Arial" display-align="center" text-align="center"> 
         LEAF 
        </fo:block> 
       </fo:block-container> 
      </fo:block> 
    </fo:table-cell> 

任何人都可以幫助我解決這個錯誤,並指導我可以做什麼錯誤。我使用ApacheFOP 2.1

回答

0

XSL-Recommendation指出:

該地區的位置(以及可能的大小)與「左」,「右」,「頂」和「底」屬性中指定。 這些屬性指定相對於區域最近的祖先參考區域的偏移量。

絕對定位的區域被取出正常流程。這意味着他們對後面的兄弟姐妹的佈局沒有影響。

所以:

  • 沒有必要把其他物體內的絕對定位fo:block-containerfo:block元素,它們可以是fo:flow
  • 直接孩子,我不知道你想什麼在第二個fo:block-container上通過bottom="-229px"屬性實現,但其實際效果是將該區域放置在遠離身體區域的地方,完全在頁面外;如果你要的對象重疊,使用top相反,具有比其他容器的高度
  • 此刻小的值,z-index is not supported by FOP所以可以去除過多;重疊對象根據它們在文檔中的順序堆疊,所以第一個在下面的順序下,最後一個出現在所有其他的上面

這是簡化的結果,由FOP處理而沒有錯誤:

<fo:flow flow-name="xsl-region-body"> 

     <fo:block height="229px" absolute-position="absolute"> 
      <fo:external-graphic scaling="non-uniform" src="url('http://previews.123rf.com/images/nujalee/nujalee1108/nujalee110800004/10410227-Beautiful-green-leaf-isolated-on-white-Stock-Photo-leaf-texture.jpg')" content-height="229px" content-width="110px"/> 
     </fo:block> 
     <fo:block-container background-color="#538000" height="20px" width="77px" absolute-position="absolute" top="30px"> 
      <fo:block color="#333333" font-size="10px" height="20px" font-family="Arial" display-align="center" text-align="center"> 
       LEAF 
      </fo:block> 
     </fo:block-container> 

    </fo:flow> 

(作爲最後一點,錯誤本身可能是由於一個bug)

披露:我是一個FOP開發商,雖然不是很活躍的今天。