sprain / php-swiss-qr-bill

A PHP library to create Swiss QR bills | QR-Rechnung in PHP erstellen
MIT License
279 stars 82 forks source link

mPDF outputs raw CSS #221

Closed JDittmerCOM closed 1 year ago

JDittmerCOM commented 1 year ago

I use mpdf to generate PDF because this is the best generator for me. However, if I want to output the HTML version, it shows me the pure CSS code. Do you have any idea how I can fix this?

image

sprain commented 1 year ago

There is no official mPDF support provided by this libary.

But maybe what you can find in this abandoned pull request will help? https://github.com/sprain/php-swiss-qr-bill/pull/115

JDittmerCOM commented 1 year ago

When I try like in the old issue I only get the following message in VSC.

Undefined type 'Sprain\SwissQrBill\PaymentPart\Output\MpdfOutput\MpdfOutput'.

sprain commented 1 year ago

Undefined type 'Sprain\SwissQrBill\PaymentPart\Output\MpdfOutput\MpdfOutput'.

Yes, this is expected, as it is an abandoned pull request that was never merged. I thought, maybe you'd find some idea or inspiration there that would help you.

There is no finished solution for using mPDF with this library, and unfortunately I personally will not be able to help you out here. Maybe somebody else who stumbles upon this issue will be able to do so.

JDittmerCOM commented 1 year ago

The problem is simply that there is no solution to it. With the other PDF plugins there were always problems with the header and footer and HTML. Now I just have the problem here between Mpdf and your plugin.

Just don't understand why there must always be problems with the simplest CSS.

JDittmerCOM commented 1 year ago

That the pure CSS is not displayed can be checked with $mpdf->WriteHTML($html); solve without the second parameter at mpdf.

On the other hand, I have now been able to solve it with NPM and Puppeteer. Where I send the HTML content to my service port I get a Base64 URL back as a result and then include the image in the PDF.

But thanks for the replies here.

My current result image