#How to export html blade to pdf?

1 messages · Page 1 of 1 (latest)

raven rose
#

I'm having issues exporting blade to pdf

balmy mural
#

So.. what are those issues exactly? Can't really help you if you don't provide any information

raven rose
#

I have this invoice page in laravel blade that I want to export to pdf. But I've tried several libraries and it didn't work. I've tried domPDF, snappy, and html2pdf.js

balmy mural
#

Why didn't those work? Since those are packages intended to solve the problem you're facing; generating PDFs

dusky swan
#

Most of these types of packages require some PHP extensions to be enabled. Have you got them installed and enabled?

#

PHP version 7.1 or higher
DOM extension
MBString extension
php-font-lib
php-svg-lib

raven rose
#

It just returns a raw pdf content instead of download the pdf file

raven rose
dusky swan
#

php -m

#

In your terminal

#

Can you please send the code you're running to do this?

raven rose
#

Well its basically just this

        return $pdf->download('invoice.pdf');```
#

I'm using domPDF

dusky swan
#

Try it without ->output()

raven rose
#

Its still the same just return raw pdf like this and didn't download pdf

raven rose
balmy mural
#

My laravel is 5.8
You should probably focus on other things then, that version is 5 years old and hasn't received any security updates for 4 years. It also means you're likely using PHP 7.3 (or older), which ended support like 2.5 years ago and doesn't get security updates either

raven rose