php 如何在php中将页面另存为pdf

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7495509/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 02:48:45  来源:igfitidea点击:

How to save a page as pdf in php

php

提问by Jin Yong

Does anyone know how I can save a page as pdf in php?

有谁知道如何在 php 中将页面另存为 pdf?

Example: I have a page that is able to catch the users signature. Now I would like to create a button on the page that will convert the page into pdf so that the file can be saved to a folder.

示例:我有一个能够捕获用户签名的页面。现在我想在页面上创建一个按钮,将页面转换为 pdf,以便将文件保存到文件夹中。

Below you can see what the signature page looks like: enter image description here

您可以在下面看到签名页面的样子: 在此处输入图片说明

采纳答案by adatapost

There are a number of PHP PDF API and tools which convert or wrap up html content including drawings, links and images etc.

有许多 PHP PDF API 和工具可以转换或包装 html 内容,包括绘图、链接和图像等。

A very good thread from StackOverflow :

来自 StackOverflow 的一个非常好的线程:

  1. Convert HTML to PDF using PHP
  1. 使用 PHP 将 HTML 转换为 PDF

回答by Ali Gangji

TCPDF can output PDF's from html: http://www.tcpdf.org/

TCPDF 可以从 html 输出 PDF:http: //www.tcpdf.org/

If you need to use more advanced html you can use WKHTMLTOPDF: http://wkhtmltopdf.org/

如果您需要使用更高级的 html,您可以使用 WKHTMLTOPDF:http://wkhtmltopdf.org/