Replace dompdf (don't convert from html to pdf)

I’m on v2

just recently i was playing around with custom templates and i got really frustrated with dompdf as it’s more likely converting a html site to a pdf instead of generating a pdf directly.

For example, the main issues i had is

when your invoice is longer and your table with your products/services exceed a page, it really get awkward. the table header will be repeated out of knowwhere, there’s no page numbers, the header is not repeated each site, and the footer is available on the last page only.

i have been using other pdf generators such as fpdf or mpdf for decades to generate all sorts of pdf files and found it much more versatile having loads of tools to my disposal to generate almost every scenario there could be.

i quickly realized that creating a custom template will be very limiting.
if you ask me, html and pdf should not be build on top of each other in form of one convertes to the other, but individually bringing out the best features when working with a “public” html version, and a generated pdf.

Last Update: 2018-10-13

What would your suggestion be for generating PDFs? If not HTML, how are users supposed to customize their templates?

mPDF offers to generate PDF Files with PHP as well as html.

Basic example

$mpdf = new \Mpdf\Mpdf();

$html .= '<h2>Invoice</h2>';
$html .= '<table>';
$html .= '<tr>';
// ...

// Where's the Page Numbering with dompdf?

There’s even comparable methods for either php and html such as

// same as

Obviously the current html version which is found by invoiceplane can also be converted to pdf that way.

I am just saying dompdf is quite limiting and is past it’s prime. at least at how i see the options we have currently.

Template wise it might not be identical, but it could still be manageable once there’s a thoughtful way of keeping everything quite flexible.

I wrote code once for Yii framework that used an ODF template to generate invoices.

If this request is accepted by the devs as a required feature, then I can find the code and work to convert it for 1.5x (I am not using 2.0).

i wouldn’t call it a request. let’s call it an observation that dompdf might not be something to invest alot of time in.

i am always a bit struggling when the invoice is not outputting these small little details and for the most part all other features are more or less not necessary or a small benefit. at my free time i sometimes imagine to just code a simple script to add a few database-less data structures for products, name and whatsoever and let it get output by mpdf in my custom invoice template output by mpdf and skipping on all the other functions.

I guess i could get something like that done in a few hours but was hesitant to get startet so far. Otherwise I have also taken a look at competitors here but invoiceplane was the rather slimmest of those and most of them are (still) using dompdf.

Back in the days, i have had long emails with Jesse (FusionInvoice Author) talking about dompdf and those details. He seemed to work towards alternatives but at the end of the story it never gotten that far and obviously I have never become a customer because of that fact.

mpdf is great indeed (eventhough it struggles with z-indexes).

no idea why with mpdf it shouldn’t be manageable to work with templates, i mean we can also just call html and individual css… and just how easy it is to get page numbers… maybe i will be spending more time on my own solution …

maybe there are some hacks for page numbers in dompdf?