【发布时间】:2019-05-14 15:46:43
【问题描述】:
我正在尝试使用 PrintJS 库。它允许您定位特定的 id 并打印该 id 中包含的 html。我面临的问题是,当我更改屏幕尺寸时,它也会更改 div 的打印尺寸。它们为您提供了传入 css 的选项,但并非所有更改都被应用。
这是我的测试用法:
printJS({printable: 'oogles', type: 'html', style: '.modal-header { color: red; width: 100px; } .modal-body { width:100% }'})
一些css更改已成功应用于color: red等样式部分,但更改宽度似乎不起作用。我尝试过width: 100%; 或任意设置为特定宽度,如width: 100px;
html:
<div id='oogles'>
<div class='modal-header'>wooooooo we are printing some things!</div>
<div class='modal-body'>well we are trying at least</div>
</div>
有人有使用 PrintJS 调整打印元素宽度的经验吗?
谢谢
【问题讨论】:
标签: javascript jquery printjs