2015-01-05 48 views
0

我想在畫面A的前面重疊圖象B重疊外部圖形

但是我沒有看到圖像A,只有當我將刪除圖像B.

我用z-index = 1體驗和z-index = 2。但這隻適用於圖像和文字?

<fo:table-row> 
 
\t <fo:table-cell border="1pt solid black" padding="2pt"> 
 
\t \t <fo:block-container> 
 
\t \t \t <fo:block-container position="absolute"> 
 
\t \t \t \t <fo:block> 
 
\t \t \t \t \t <fo:external-graphic content-width="scale-to-fit" content-height="100%" width="100%" scaling="uniform"> 
 
\t \t \t \t \t \t <xsl:attribute name="src"> 
 
\t \t \t \t \t \t \t <xsl:value-of select="./giftCardLogo" /> 
 
\t \t \t \t \t \t </xsl:attribute> 
 
\t \t \t \t \t </fo:external-graphic> 
 
\t \t \t \t </fo:block> 
 
\t \t \t </fo:block-container> 
 
\t \t \t <fo:block-container position="absolute"> 
 
\t \t \t \t <fo:block> 
 
\t \t \t \t \t <fo:external-graphic content-width="scale-to-fit" content-height="100%" width="100%" scaling="uniform"> 
 
\t \t \t \t \t \t <xsl:attribute name="src"> 
 
\t \t \t \t \t \t \t <xsl:value-of select="./giftCardThemePicture" /> 
 
\t \t \t \t \t \t </xsl:attribute> 
 
\t \t \t \t \t </fo:external-graphic> 
 
\t \t \t \t </fo:block> 
 
\t \t \t </fo:block-container> 
 
\t \t </fo:block-container> 
 
\t </fo:table-cell> 
 
\t <fo:table-cell border="1pt solid black" padding="2pt"> 
 
\t \t <fo:block> 
 
\t \t \t <fo:instream-foreign-object> 
 
\t \t \t \t <bc:barcode xmlns:bc="http://barcode4j.krysalis.org/ns"> 
 
\t \t \t \t \t <xsl:attribute name="message"> 
 
\t \t \t \t \t \t <xsl:value-of select="./giftCardNumber" /> 
 
\t \t \t \t \t </xsl:attribute> 
 
\t \t \t \t \t <bc:datamatrix> 
 
\t \t \t \t \t \t <bc:module-width>1.0mm</bc:module-width> 
 
\t \t \t \t \t </bc:datamatrix> 
 
\t \t \t \t </bc:barcode> 
 
\t \t \t </fo:instream-foreign-object> 
 
\t \t </fo:block> 
 
\t </fo:table-cell> 
 
\t <fo:table-cell border="1pt solid black" padding="2pt"> 
 
\t \t <fo:block>&#x00A0;</fo:block> 
 
\t </fo:table-cell> 
 
</fo:table-row>

回答

0

(你不提您所使用的圖像輸出格式的格式,並FOP的版本,所以它不容易給出你的答案)

如果我理解正確,你有兩個圖像,並希望將它們放在相同的位置,一個作爲背景,一個作爲前景;例如,可以有水平線和其他垂直線,您希望在輸出中看到網格,但只能看到「最後一組」線。

我使用FOP 1.1進行測試,使用帶有透明背景和不同級別的對象透明度(Alpha通道)的png和svg圖像,並創建PDF輸出(可能是最常見的選擇):everyting按預期顯示。

所以,你的問題可能由下列原因造成:

  • 圖片的格式:PNG,GIF和SVG支持透明背景/α-通道; JPG不
  • SVG的功能您的圖像使用:即使你使用SVG圖像,某些功能(效果,圖案,引用的圖像,...)的處理創造一個光柵圖像,thus losing transparency
  • 的輸出格式FOP's page about graphics formats指出對於gif和png圖像「支持透明度,但不保證可用於每種輸出格式」; PDF是確定

最後,z-indexis not supported at the moment:根據文檔順序在輸出圖像「堆疊」,所以第一個是在以下的,最後一個是在前臺。