Support the ongoing development of Laravel.io →
Packages
Last updated 1 year ago.
0

I've used both PhantomJS and Wkhtmltopdf as binaries run with symfony/process in the application. Both are good, but Wkhtmltopdf handles fonts better from my experience.

There is a library available for Laravel which wraps the Wkhtmltopdf binaries (https://github.com/NitMedia/wkhtml2pdf), but I've had mixed success (it had a bug where anything logged to stderr was considered an error, rather than checking the exit code). It'd be worth giving it a go though.

Last updated 1 year ago.
0

I use dompdf, it works really well.

Last updated 1 year ago.
0

+1 dompdf

Last updated 1 year ago.
0

You may also try this http://www.html2pdf.fr/en/default

Last updated 1 year ago.
0

I've also used wkhtmltopdf with a Laravel project with success. However, I did not use the Laravel package mentioned above. I ended up extending the core a bit so I could use View::pdf () and render the results of a view as a PDF document.

Internally this worked by saving the results of the view into a temporary HTML file whose path and name could be determined ahead of time. Then I used shell_exec to pass the path of the temp HTML file to wkhtmltopdf. The output path is also predetermined in this process. After all of this I just used Response::download() with the appropriate temp file name and headers.

Its not too difficult if you can control the file paths yourself and have access to reads and writes on the file system.

Last updated 1 year ago.
0

Hi,

thanks for your advice.

I have resolved this issue. I did not change any php code and configuration. I am using google fonts to fix the character problems.

Best Regards.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link href='http://fonts.googleapis.com/css?family=Dosis&subset=latin,...' rel='stylesheet' type='text/css'>
</head>
<body>

<p style="font-family: 'Dosis', sans-serif;">Abc def ghı ijk lmn oöp rsş tuü vyz</p>
<p style="font-family: 'Dosis', sans-serif;">ABC DEF GHI İJK LMN OÖP RSŞ TUÜ VYZ</p>

</body>
</html>
Last updated 1 year ago.
0

I have also created package that wraps Wkhtmltopdf: https://github.com/barryvdh/laravel-snappy (And one that wraps DomPDF with the same api: https://github.com/barryvdh/laravel-dompdf)

It's called laravel-snappy because it uses https://github.com/KnpLabs/snappy instead of accessing wkhtmltopdf directly (= more popular, better tested etc)

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.