Forum How do I...?

Batch generation

dan.konsoer
Hi, my company is investigating solutions and came across Prince.

There are multiple cases that we would use Prince for - one would be to generate a single PDF through PHP and display on screen for the user. Another case would be for a user to be able to run customer invoicing through a PHP interface and generate and store these invoices in each of the corresponding customer folders, while hopefully being able to merge them all into one PDF for the user to download and print.

I'm unclear if I can generate multiple PDFs through the PHP interface, or if it would be better to run exec within PHP to run these on the command line, and have it return a link to download the final PDF with a couple hundred invoices held within it. I can write a PHP script to generate hundred of HTML files, to pass through to Price if necessary

Please advise if this can be accomplished with Prince or what your recommendation would be. Thank you.
mikeday
Prince only generates one PDF file at a time, but you can call it multiple times through the PHP interface to generate as many PDFs as you need, or just one PDF, whichever is more convenient for you.

One potential issue is that web browsers don't like to wait too long for HTTP requests to complete, so if you are launching the conversion from a web form and it takes longer than 30 seconds then it might be better to start a background process and allow the web browser to poll the page to see when it's ready.