How to create PDF file in Batch


Joined
May 11, 2022
Messages
3
Reaction score
0
I have a very large dataset in the MySQL database that I want to export in a PDF file.

I am working in PHP and tried popular solutions like DOMPdf and Mpdf.

They all work in a similar way, preparing the complete data in HTML and feeding it to their functions to generate the PDF files.

My problem is that I cannot generate the whole HTML files at once and it is very resource-intensive to fetch complete data in a single query and generate that whole HTML.

I have already created a CSV file with that data. It was simple to do in batch as I can fetch a few entries from the database, write them in a file and then run the same process through Ajax to append the data.

I am looking for a similar solution to generate this large PDF file.

Please suggest the best way to handle it.

Thanks
 
Ad

Advertisements

Joined
Jan 24, 2022
Messages
25
Reaction score
1
I would suggest if you want to create a PDF in a new batch sequence so you may try this method:
Step 1: You click on the File menu and there you will find Batch processing.
Step 2: In the Actions list, right-click the action you need to perform and then click Add to sequence, followed by New…
Step 3:
In the Actions Sequences list, double-click on New Sequence to name the sequence
Step 4: Press the Enter key to commit the new name
Step 5: Once again, in the Actions list, right-click another action and then click Add to sequence followed by the name of your custom sequence. Repeat this task for all the actions you need
Step 6 : Left-click an action in your sequence and then click Properties to configure the default settings for the action
Step 7: Left-click your actions sequence to select it, and then click Run. Alternatively, click Close to exit the tool
 
Joined
May 11, 2022
Messages
3
Reaction score
0
Hi thanks for your reply, but I think I failed to explain to you that I want to generate this PDF file using PHP programming language not directly from MySQL.
Thanks
 
Ad

Advertisements

Joined
Mar 11, 2022
Messages
63
Reaction score
8
Well actually you've already mentioned the most common used php classes to do that.

Well give me a little background information. So your datasets are what? HTML, complete HTML documents or what exactly?

Well first of all. Those PHP PDF Classes can handle HTML to a certain point only. They use tables instead of divs and so on and so on. So there's a little bit of an effort needed to convert those structure. But i guess that's not really your problem.

You've mentioned your very large dataset. Well, you may do that in the same way as you did with your CSV. Step by Step with ajax and then merge the PDF Pages at the end. But that's also a woubby solution because ajax request may fail.

Next thing that comes to my mind is using a page reload with a PAGE GET Attribut. So you may limit your query to e.g. 5000 entries for each Page. Plus the reload clears your RAM. So should be a little bit quicker and saver than the ajax solution.
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top