Vue.js - 如何打印自定义尺寸的网页?
我有一个 HTML 发票模板,我想用自定义尺寸(如 80 毫米和 297 毫米)打印此模板(整页).我试过这段代码:
I have an HTML invoice template and I want to print this template (WHOLE PAGE) with custom sizes like 80mm and 297mm. I tried this code:
@media print {
@page {
size: 80mm 297mm;
margin: 0;
}
}
但它不起作用.如何打印具有自定义尺寸的页面?
but it's not working. How can I print a page with custom sizes?
推荐答案
CSS解决方案:
.printableArea {
width: 8.5cm; // !important
height:100%; // !important
}
@page {
size: 8cm auto; //
width: 8cm; //
height: 100%; //
margin: 0;
margin-left: 5px !important; // this is for me.
}
相关文章