简体   繁体   中英

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. I have experience with HTML, CSS, PHP, MySQL, JavaScript, JQuery, and 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. 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.

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? 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.

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. 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.

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. On an Ubuntu box you can simply install it using 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. Hope that helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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