我正在尝试使用 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 调整打印元素宽度的经验?
谢谢