The only reason I can guess as to why I hit this problem is that html2pdf does a conversion into xhtml as part of the process.
Now the astute reader may have noticed that my HTML file is smaller than 100k. max_execution_time = 600 # yes, 10 minutes.memory_limit = 1024M # yes, one gigabyte and.pcre.backtrack_limit = 2000000 # probably more than I need but that's OK.It requires the following php.ini settings: So I have a 70k HTML file to turn into PDF. At least if an error had been raised and logged you'd have some indication of what happened, why and what to change to fix it. What's horrifying about this is that when the limit is exceeded, the replace just silently fails. Why such a low value? Again, no idea.Ī bug was raised against PHP 5.2.1 for this, which is still open almost two years later. What this config parameter does is limits the string length for which matching is done. PHP 5.2.1 introduced a php.ini config directive called pcre.backtrack_limit. Basically, PHP 5.1.x worked fine with regex replaces (preg_replace_*) on strings of any size.
HTML2PDF looked the most promising but I kept having this weird error about null reference arguments to node_type. DOMPDF did a terrible job with tables, borders and even moderately complex layout and htmldoc seems reasonably robust but is almost completely CSS-ignorant and I don't want to go back to doing HTML layout without CSS just for that program. What am I missing, or how can I resolve this issue? Approach 1:Īfter some investigation and general hair-pulling the solution seems to be HTML2PDF.
I tried a Windows app called Html2Pdf Pilot that actually did a pretty decent job but I need something that at a minimum runs on Linux and ideally runs on-demand via PHP on the Webserver.
Mac to ubuntu), issues with rendering on ubuntu (requiring need to install a Definitely issues with installation (going from My experience has been that I ate up what would have been a lot of the $3k > My understanding is that wk is nearly as good without the $3000 price
> really lovely CSS-controlled PDF layouts. > wrapper in Rails to use that, I recommend it heartily. > I've used PrinceXML in another (PHP) project. ` directly, but it depends on what you are trying > For my app, I found it easier to not use any of the gems, but just > dependencies, had to do with scaling and fonts.) > installed and acting the same way on my server as it did on my The largest pain I had was getting wkhtmltopdf > you don't care about exact placement of items. > I've played around with all three and have found them all to work if