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

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

问题描述

我正在计划为客户在线提供价目表,并且我正在考虑一些简单的长页面或div容器,其中有一些锚定链接可以帮助您跳转到不同的产品。 $ b

但是,如果有人想打印出某些产品的价目表,我不希望所有的页面都打印出来,但只打印当前的一张。
是否有任何打印中断字符或标记?

为了防止有人有更好的想法,我希望实现的所有功能都是通过html中的价目表来改变它一个地方,但仍然能够将单独的产品价目表转换为PDF文件,以便用于特定产品的电子邮件目的。

使用此CSS :

  @media print 
{
.page-break {display:block;分页-前:永远; }

}

然后在你想要的HTML中引用它页面中断:

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

现在你去了:)

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天全站免登陆