2017-05-14 116 views
1

我打開我的形象到PDF以下列方式爲PDF圖像(谷歌文檔,單詞等) 有沒有一個簡單的方法來做到這一點?插入透明使用PDFBOX

回答

2

使用擴展的圖形狀態:

stream.saveGraphicsState(); 
PDExtendedGraphicsState pdExtGfxState = new PDExtendedGraphicsState(); 
pdExtGfxState.getCOSObject().setItem(COSName.BM, COSName.MULTIPLY); // pdExtGfxState.setBlendMode(BlendMode.MULTIPLY) doesn't work yet, maybe in later version 
pdExtGfxState.setNonStrokingAlphaConstant(0.5f); 
contentStream.setGraphicsStateParameters(pdExtGfxState); 
// do your stuff 
stream.restoreGraphicsState(); 
+0

你的回答解決我的問題!謝謝 – MichaelK