拆分 HTML 页面,以便打印机将其拆分为单独的页面 [英] Splitting HTML page so Printer splits it into separate pages

查看:37
本文介绍了拆分 HTML 页面,以便打印机将其拆分为单独的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在计划可供在线客户使用的价目表,我正在考虑简单的非常长的页面或 div 容器,其中包含一些锚链接以帮助跳转到不同的产品.

但是,如果有人只想打印某些产品的价目表,我不希望打印所有页面,而只打印当前页面.是否有任何打印中断字符或标签?

以防万一有人有更好的主意,我想要实现的只是在 html 中使用价目表在一个地方进行更改,但仍然能够将单独的产品价目表转换为 PDF 文件,以便通过电子邮件发送特定产品.

解决方案

使用这个 CSS:

@media 打印{.page-break { 显示:块;分页前:总是;}}

然后在您希望页面中断的 HTML 中引用此内容:

然后你去:)

I am planning price list available for clients online and I was thinking about simple very long page or div container with some anchor links aside to help jump to different products.

However in case someone wants to print off just price list with certain products I don't want all the pages to print off but only current one. Is there any print breaking character or tag?

Just in case someone has better idea all I want to achieve is having price list in html to change it in one place but still be able to convert separate product price lists into PDF files for emailing purposes of particular product.

解决方案

Use this CSS:

@media print
{
      .page-break  { display:block; page-break-before:always; }

}

and then cite this in your HTML where you want the page to break:

<div class="page-break"></div>

And there you go :)

这篇关于拆分 HTML 页面,以便打印机将其拆分为单独的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆