在A4页面上打印版本并另存为PDF

时间:2016-08-23 05:16:36

标签: html css pdf

我被困在一个地方。我有一个HTML页面,但我想在打印页面上只有一个DIV和打印按钮,并保存为PDF,如下所示保存按钮。

<div class="abc">
    Here are some words
    <div class="def">
        Some more words
        <div class="ghi">
            This is I want for print on A4 page and save as PDF but like my letterhead with logo and other detail like microsoft word have header and footer. I want to header and footer add in header.php and footer.php but only on print and save as PDF. And this div class in the middle of letter.
            <button>Click for print</button>
            <button>Click to save as PDF</button>
        </div>
    </div>
</div>

我想打印版本作为信头 非常感谢。

1 个答案:

答案 0 :(得分:0)

您需要一个单独的工具来从HTML创建PDF,它需要位于服务器端。可能的PHP解决方案在Convert HTML + CSS to PDF with PHP?

中讨论

如果您不是需要 PDF而只是打印版本,我建议您使用CSS媒体查询进行打印。您可以使用它轻松隐藏所有不需要的部分,并使用浏览器打印按钮:

Value
相关问题