barryvdh / laravel-dompdf

A DOMPDF Wrapper for Laravel
MIT License
6.66k stars 966 forks source link

dompdf, Laravel Vapor and CSS font link error - fopen in /tmp/storage/fonts, no such file or directory #928

Open Jamiewarb opened 1 year ago

Jamiewarb commented 1 year ago

Hi there,

When attempting to use dompdf with Laravel Vapor and importing a google font via CSS import, I'm getting the following issue:

fopen(/tmp/storage/fonts/work_sans_normal_d6eeffee426555fe4bcfe67ec779bf1d.ufm): Failed to open stream: No such file or directory

The font link I'm using is

<link href="https://fonts.googleapis.com/css2?family=Work+Sans:wght@400;600&display=swap" rel="stylesheet">

It gets to dompdf's FontMetrics methods, and then tries to open this file using fopen('/tmp/storage/fonts/work_sans_normal_d6eeffee426555fe4bcfe67ec779bf1d.ufm', w+), and fails with this error.


I read the following PR within this repo, which mentions setting dompdf's font cache etc to /tmp: https://github.com/barryvdh/laravel-dompdf/issues/687

However, from the error message, it looks like this is already set to /tmp, as it's trying to open this file there.

Has anyone else gotten dompdf to work with Laravel vapor and a custom font?

angeljqv commented 1 year ago

Try to create manually that path and try again, also try this https://github.com/barryvdh/laravel-dompdf/issues/915#issuecomment-1273556405

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/dompdf/dompdf instead. When having doubts, please try to reproduce the issue with just dompdf. If you believe this is an actual issue with the latest version of laravel-dompdf, please reply to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.

akinsariozkan commented 11 months ago

@Jamiewarb Have you found a solution for this problem Jamie? Facing the exact same problem and nothing has helped yet.

MenC-Didam commented 9 months ago

same problem

drpark commented 7 months ago

same problem

sietse85 commented 7 months ago

Found solution see: https://stackoverflow.com/questions/77529293/laravel-vapor-docker-dompdf-not-rendering-custom-fonts-works-locally-not-on/77559111#77559111