简体   繁体   English

使用PHP,JS或JQuery生成多页PDF订单?

[英]Generating multi-page PDF order with PHP, JS or JQuery?

I am working on developing a shipping/receiving system which I plan to setup on an intranet. 我正在开发计划在Intranet上安装的运输/接收系统。 I have experience with HTML, CSS, PHP, MySQL, JavaScript, JQuery, and AJAX. 我有HTML,CSS,PHP,MySQL,JavaScript,JQuery和AJAX的经验。 My basic goal is to be able to scan barcodes and then generate and save PDF's for printing and storage that can be 1 page or 100 pages. 我的基本目标是能够扫描条形码,然后生成并保存PDF以便打印和存储,可以是1页或100页。 I basically want to create a header with order information such as Order ID, Customer/Vender, Date, Page Number, etc. with columns below containing information like Part Number, QTY, Description, etc. 我基本上想创建一个包含订单信息的标头,例如订单ID,客户/供应商,日期,页码等,下面的列包含诸如零件号,数量,描述等信息。

I am not sure if the entire pages can be created with css and 'foreach variables' or if perhaps a template where text is simply placed on top of a default pdf would work best? 我不确定是否可以使用css和“ foreach变量”创建整个页面,或者不确定将文本简单地放置在默认pdf顶部的模板是否效果最好? In the past I have been able to take a basic template and enter text onto a single page pdf at a specific X and Y co-ordinate, but I am not sure about detecting page breaks and the such. 过去,我已经能够采用基本模板,并在特定的X和Y坐标下将文本输入到单页pdf中,但是我不确定要检测分页符等。

Any advice on where to begin would be greatly appreciate! 任何关于从哪里开始的建议将不胜感激! Thanks in advance :) 提前致谢 :)

Take a look at FPDF , it's a quite powerful PHP library for creating PDF:s. 看一下FPDF ,它是一个功能强大的PHP库,可用于创建PDF:s。 I've used it quite a lot and I'm sure it would fit your needs. 我已经使用了很多次,我相信它会满足您的需求。

I don't think it's necessary to have a template upon which you position text. 我认为没有必要在上面放置文本的模板。 You could for example use the table capability provided by third party scripts in FDPF for presenting your data. 例如,您可以使用FDPF中第三方脚本提供的表功能来显示数据。

Using a solution such as wkhtmltopdf which is a HTML to PDF converter, you can generate the html for the invoice using php and output the PDF file using the tool. 使用wkhtmltopdf这样的HTML到PDF转换器的解决方案,您可以使用php生成发票的html,并使用该工具输出PDF文件。 On an Ubuntu box you can simply install it using sudo apt-get install wkhtmltopdf . 在Ubuntu盒子上,您可以简单地使用sudo apt-get install wkhtmltopdf wkhtmltopdf is a commandline tool so you might have a cron running in the background which picks up html files within a folder and converts them to PDF using the tool or using php exec() or system() functions to execute the program. wkhtmltopdf是一个命令行工具,因此您可能会在后台运行cron,该cron会拾取文件夹中的html文件,然后使用该工具或使用php exec()system()函数将其转换为PDF,以执行该程序。 Hope that helps 希望能有所帮助

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

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