2

我有一张带有 L.markerClusterGroup 的传单地图。它看起来像这样:

在此处输入图像描述

但是在打印(到 PDF)时,它看起来像这样:

在此处输入图像描述

注意没有背景颜色。

点创建如下:

L.DivIcon({ html: '<div><span>' + (childCount + tally) + '</span></div>', className: 'marker-cluster' + <my own css>, iconSize: new L.Point(40, 40) });

其中“我自己的 css”是 css 类,可能是以下之一:

background: rgba(255, 0, 192, 0.3); !important;
border: 1px solid #666;

或者

background: rgba(9, 243, 33, 0.6);!important;
border: 1px solid #666;

其他人有过同样的问题吗?

4

1 回答 1

1

我的问题是糟糕的 CSS。background: rgba(255, 0, 192, 0.3); !important;而不是background: rgba(255, 0, 192, 0.3) !important;.

这是工作的CSS:

@media print {

  .my-own-css1, .my-own-css2, {
        -webkit-print-color-adjust: exact !important;         
         background: rgba(255, 0, 192, 0.3) !important;
    }
}
于 2016-08-24T13:35:32.703 回答