php 如何从php中来自mysql数据库的动态数据生成pdf文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22349873/
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-25 04:51:16  来源:igfitidea点击:

How to generate pdf file from dynamic data coming from mysql database in php?

phpmysqlpdfpdf-generation

提问by Yogesh k

I am doing one web application society management system. In this application I want to generate pdf file for each user separately. Means during invoice generation , if there are 10 users then for each user separate invoice should get generated as a pdf after clicking on generate PDF button. My invoice got generated for each user but now I dont understand how to convert it into pdf dynamically. So please help me in this question ?

我正在做一个网络应用社会管理系统。在这个应用程序中,我想分别为每个用户生成 pdf 文件。意思是在发票生成过程中,如果有 10 个用户,那么在点击生成 PDF 按钮后,每个用户都应该以 pdf 格式生成单独的发票。我的发票是为每个用户生成的,但现在我不明白如何将其动态转换为 pdf。所以请帮助我解决这个问题?

回答by user3364940

Use any of the following php scripts to generate dynamic PDF documents

使用以下任一php脚本生成动态PDF文档

fpdf: http://www.fpdf.org/

fpdf:http://www.fpdf.org/

tcpdf: http://www.tcpdf.org/

tcpdf:http://www.tcpdf.org/

回答by Alex Hernández

You probably have to check out this lib: mPDF

您可能需要查看此库:mPDF

It's quite easy to use and allows you to generate PDF from HTML templates.

它非常易于使用,并允许您从 HTML 模板生成 PDF。