2

I'm looking to write HTML tables, which contain PHP variables inside the columns, to a unique PDF file. From the way it looks, there's no way to simply write an HTML table to a PDF file. Does anyone have any tools that do this, or a script that would point me in the right direction?

Thanks!

2 Answers 2

3

You might want to check out dompdf

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! Not sure how I didn't find this.
1

I've recently been testing DomPDF (as mentioned by julesj) and mPDF as alternatives to tcPDF. I encountered a few problems with html tables when using DomPDF (e.g. missing the first row on each page), and found mPDF fractionally faster, but needing significantly more memory. However, the generated PDF file was much cleaner than that generated using DomPDF. Conversely, DomPDF has a much smaller disk size footprint.

2 Comments

dompdf definitely still needs a bit of work around tables. I haven't seen the issue you cite (missing first row), but the biggest problems surrounding tables are: a) losing column alignment across pages, b) not being able to split a row/cell into two ... resulting in either large gaps at the bottom of a page or in the worst case an infinite loop. There are other, less serious issues around tables but those are the biggest.
The DomPDF developers do seem very active, and potentially the HTML to PDF could become a very good feature, but I think it still needs a bit of work before it reaches that stage.... one to keep an eye on for the future.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.