Transforming HTML into PDF is not always so simple as it is necessary to render the content and then convert it. Solutions that attempt to convert HTML to PDF based on style or simplistic assumptions tend to have many limitations, such as with table tags, img, etc.
The best alternative is probably to use a Webkit HTML renderer that converts to PDF or PNG, as you prefer. The http://wkhtmltopdf.org/ is one of the best, we have used for years in a very aggressive environment of converting everything that is document type, including with images, CSS, Tables, headers and footers, custom margins, everything:
1) Install wkhtmltopdf on the server.
2) Create a script (PHP, Perl, as you wish) that receives HTML, invoke the wkhtmltopdf command and output the application/pdf back to the client.
3) On the web page, via javascript give a POST of HTML content to the script created on the server-side.
If you are already on the server-side and use PHP, there is already a project that does this port: https://github.com/mikehaertl/phpwkhtmltopdf
I made a direct IPC with the wkhtmltopdf executable to have full control did not give more than 10 lines (in my case in PERL). In PHP it should be very simple too.
I have a similar problem currently, but it decreases the problems considerably in the generation of PDFS by removing the standard CSS that it defines in config.php
– Leandro RR
You have removed in the Leandro file itself, or is there any method to disable the upload?
– Taisa Silva
I manually removed in the config.php file of mPDF, has an array there with some default styles that it even applies at the time you have the PDF generated, which implies the problems you had. but not everything it generates correctly.
– Leandro RR
I get it. I’ll try to remove and see if I have a better result.
– Taisa Silva
yes, look at the example at the end of code http://pastebin.com/DsaXUPyf
– Leandro RR
It did not work in this case Leandro, even removing the default formatting.
– Taisa Silva
take a look at the documentation http://mpdf1.com/manual/index.php?tid=34, I don’t know if it will help you, in this case the staff decided to do with another pdf generator, called Snappy https://github.com/KnpLabs/snappy
– Leandro RR
It is his documentation is very vague... does not give me examples of using tables.
– Taisa Silva
with tables he proved horrible.
– Leandro RR
Guys, I still can’t find a solution to this question I need more suggestions... someone?
– Taisa Silva
got it? if we don’t look for a solution together! =)
– Leandro RR
I use mPDF with Smarty and call css via link rel (<link rel="stylesheet" href="css/pdf.css">) in my template, and it works perfectly. already tried to put the reference to css directly?
– mend3