从CSS打印的特定格式(Specific format for printing from CSS)

编程入门 行业动态 更新时间:2024-10-19 04:32:58
从CSS打印的特定格式(Specific format for printing from CSS)

我必须打印一些东西,它必须非常具体。

现在,我尽可能地走了,但我想知道的是如何使表适合指定的边距。

/* ===== Printing ===== */ @media print { /*Reset Style*/ body { margin:0; padding:0; } /*Remove Element*/ .main, .wrapper, .pat_index_col1, #header, #footer, .dataTables_wrapper, #h4 { display:none; } .print { height: 132.283464567px; width: 264.566929134px; border:1px solid #000; border-radius:5px; page-break-inside:avoid; } table { width: 264.566929134px; height: 132.283464567px; } thead { font-family:Arial, Helvetica, sans-serif; font-size:10px; } tbody { font-family:Arial, Helvetica, sans-serif; font-size:12px; } tfoot { font-family:Arial, Helvetica, sans-serif; font-size:8px; background-color:#060; } }

我需要表格符合上面指定的参数。 它们必须很大,因为它们需要适合特殊标签。

有没有办法可以在print语句中放置一个表格,以便它强制适应那些“边距”? 或者,如果有另一种方法来打印HTML以使其符合指定的尺寸,我将非常愿意调查它。

I have to print something and it's got to be pretty specific.

Now, I've gone as far as I can, but what I want to know is how to make a table fit within the margins specified.

/* ===== Printing ===== */ @media print { /*Reset Style*/ body { margin:0; padding:0; } /*Remove Element*/ .main, .wrapper, .pat_index_col1, #header, #footer, .dataTables_wrapper, #h4 { display:none; } .print { height: 132.283464567px; width: 264.566929134px; border:1px solid #000; border-radius:5px; page-break-inside:avoid; } table { width: 264.566929134px; height: 132.283464567px; } thead { font-family:Arial, Helvetica, sans-serif; font-size:10px; } tbody { font-family:Arial, Helvetica, sans-serif; font-size:12px; } tfoot { font-family:Arial, Helvetica, sans-serif; font-size:8px; background-color:#060; } }

I need the table to fit within the parameters specified above. They have to be that big because they need to fit inside special labels.

Is there a way you can put a table within the print statement so that it forces to fit within those 'margins'? Or if there is another way to print HTML so it fits into the specified dimensions, I would be more than willing to look into it.

最满意答案

对于我打算做的事情(或尝试做的事情),我决定选择jsPDF ,就像我想做的那样。

For what I intend to do (or try and do), I decided to go with jsPDF as it did what I wanted to do.

更多推荐

本文发布于:2023-08-01 14:44:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1359219.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:格式   CSS   Specific   printing   format

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!