简体   繁体   English

将多页html导出为单个pdf

[英]Export more than one page html to single pdf

I have a little project built in php/javascript which every page are split in two parts. 我有一个用php / javascript构建的小项目,每个页面都分为两部分。 On left side a list of href, for example 例如,左侧是href列表

<a href="index.php?id=1>page 1</a>
<a href="index.php?id=2>page 2</a>
<a href="index.php?id=3>page 3</a>

then on right side some code block that load info from xml file (file1.xml, fil2.xml, file3.xml) depending on id of url 然后在右侧,根据URL的ID,一些代码块从xml文件(file1.xml,fil2.xml,file3.xml)加载信息

Now I need to create a button at the end of left list that create a single PDF of all this page 现在,我需要在左侧列表的末尾创建一个按钮,以创建所有此页面的单个PDF

Any Suggestions? 有什么建议么?

You can use DOMPDF to generate PDF from HTML. 您可以使用DOMPDF从HTML生成PDF。 So what you can do is you can write a PHP script that grabs all data from those pages, combine it in one HTML code and convert to PDF using DOMPDF. 因此,您可以做的是编写一个PHP脚本,从这些页面中获取所有数据,将它们组合为一个HTML代码,然后使用DOMPDF转换为PDF。

I think the easy way to do this: 我认为这样做的简单方法是:

(1) convert your html pages to PDF 'online' using web2pdfconvert , htmlpdf or pdfcrowd (1)使用web2pdfconverthtmlpdfpdfcrowd将html页面转换为PDF“在线”

(2) then put the PDF file on your server (2)然后将PDF文件放在您的服务器上

(3) create a button, that when you click it will download the PDF file (3)创建一个按钮,单击该按钮将下载PDF文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM