From 4724365f3b108d97dbf1b76381622206be607668 Mon Sep 17 00:00:00 2001 From: Jonas Boserup Date: Wed, 29 Mar 2023 14:03:17 +0200 Subject: [PATCH 1/2] Create font cache directory if it doesn't exist --- src/ServiceProvider.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 6392091..2d62f21 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -4,6 +4,7 @@ use Dompdf\Dompdf; use Exception; +use Illuminate\Support\Facades\File; use Illuminate\Support\Str; use Illuminate\Support\ServiceProvider as IlluminateServiceProvider; @@ -64,6 +65,8 @@ public function register(): void $this->app->bind('dompdf.wrapper', function ($app) { return new PDF($app['dompdf'], $app['config'], $app['files'], $app['view']); }); + + File::ensureDirectoryExists($app['config']->get('dompdf.options.font_cache')); } /** From c2581d0fb5a21d1556b09c5a8a34dcdb298a3bc5 Mon Sep 17 00:00:00 2001 From: Jonas Boserup Date: Wed, 29 Mar 2023 14:08:55 +0200 Subject: [PATCH 2/2] Update config --- config/dompdf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/dompdf.php b/config/dompdf.php index 8ad2022..122546a 100644 --- a/config/dompdf.php +++ b/config/dompdf.php @@ -53,7 +53,7 @@ * This directory contains the cached font metrics for the fonts used by DOMPDF. * This directory can be the same as DOMPDF_FONT_DIR * - * Note: This directory must exist and be writable by the webserver process. + * Note: This directory must be writable by the webserver process. */ "font_cache" => storage_path('fonts'),