Can a div be partially transparent in cfdocument pdfs? How?

[亡魂溺海] 提交于 2020-01-17 02:47:08

问题


Need a div to partially show the image behind it, is this even possible? Tried:

opacity:.5;

AND

filter:alpha(opacity=50);

Both produce a solid div.

Any help would be much appreciated.


回答1:


From a wondrous pure guess in a comment, I managed to find a working answer:

Did you try using a semi-transparent .png?

Yay!




回答2:


Right you are, thirtydot! You gotta toss a thumbs-up for cfdocument, eh?

I've confirmed this works in CF9. I do wonder whether this example is backward compatible.
Can anyone confirm other ColdFusion versions support this?

<cfdocument format="PDF" pagetype="letter" 
    margintop="0.5" marginbottom="0.5" 
    marginleft="0.5" marginright="0.5">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <style type="text/css">
    body { background-image: url( "images/use_your_image.jpg" ); }

    img { border: 3px solid #990000; }
    </style>
</head>
<body>
    Does transparent image appear above the background repeated image?
    <img src="images/red_transparent_100x100.png">
    <!--- Generated this at http://transparent-png-generator.com/ --->
</body>
</html>

</cfdocument>


来源:https://stackoverflow.com/questions/6065635/can-a-div-be-partially-transparent-in-cfdocument-pdfs-how

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!