Mpdf问题:导出PDF时如何使文本html不透明?

问题描述

我在their document 中找到了这个

仅背景颜色支持Alpha值(透明度),而文本颜色不支持

此声明说,不透明度属性在导出到PDF文件时不起作用。

为清楚起见,我使用MPDF库将html(具有CSS内联)层附加到PDF文件中,但是opacity属性不起作用。在mycode中表示颜色:rgba(144,111,111,0.5); 不能作为0.5透明工作, 那么,对于具有透明性的文本我该怎么办?

<html>
<head>
      <Meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <style>
            #content {
                  width: 815px;
                  position: relative;
            }

            .add-text {
                  position: absolute;
                  display: table;
                  border-collapse: separate;
                  Box-sizing: border-Box;
                  white-space: normal;
                  line-height: normal;
                  font-weight: normal;
                  font-size: medium;
                  font-style: normal;
                  text-align: start;
                  border-spacing: 2px;
                  border-color: grey;
                  font-variant: normal;
                  opacity: 0.5;
            }


            .preview-resize {
                  position: absolute;
            }

            .object-image {
                  width: 100%;
                  height: 100%;
            }

            .hidden {
                  display: none;
            }
      </style>


</head>

<body>
      <div class="add-text show-text page-active1 ui-draggable ui-draggable-handle active-object"
            id="textlayer1604984129443 " data-page="page1"
            style="left: 87px; top: 156px; color: rgba(144,111,0.5);" width="350" height="65">
            <div name="layer1" alpha="0.4" cols="30" rows="3" class="ui-state-active change-text"
                  style="color: rgb(144,111);">ADD TEXT...asdasd</div>
      </div>
</body>

</html>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)