From 45068445b199d46acb48eb484a85c20b1d67999c Mon Sep 17 00:00:00 2001 From: Ehsan Kiasaty Date: Tue, 22 Oct 2019 21:04:46 +0330 Subject: [PATCH 1/6] Update mpdf_ttfonts_config.php --- src/mpdf_ttfonts_config.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mpdf_ttfonts_config.php b/src/mpdf_ttfonts_config.php index dc207e2..f171ba9 100644 --- a/src/mpdf_ttfonts_config.php +++ b/src/mpdf_ttfonts_config.php @@ -1,5 +1,4 @@ fontdata = array_merge($this->fontdata, Config::get('pdf.custom_font_data')); +define('_MPDF_SYSTEM_TTFONTS', config('pdf.custom_font_path')); +$this->fontdata = array_merge($this->fontdata, config('pdf.custom_font_data')); From 7522add45fff232404bc7099a7548c473939087c Mon Sep 17 00:00:00 2001 From: Ehsan Kiasaty Date: Tue, 22 Oct 2019 21:06:19 +0330 Subject: [PATCH 2/6] Update Pdf.php --- src/LaravelPdf/Pdf.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/LaravelPdf/Pdf.php b/src/LaravelPdf/Pdf.php index dc0229c..e0094ca 100644 --- a/src/LaravelPdf/Pdf.php +++ b/src/LaravelPdf/Pdf.php @@ -2,7 +2,6 @@ namespace niklasravnsborg\LaravelPdf; -use Config; use Mpdf; /** @@ -62,13 +61,13 @@ protected function getConfig($key) if (isset($this->config[$key])) { return $this->config[$key]; } else { - return Config::get('pdf.' . $key); + return config('pdf.' . $key); } } protected function addCustomFontsConfig($mpdf_config) { - if (!Config::has('pdf.font_path') || !Config::has('pdf.font_data')) { + if (!config()->has('pdf.font_path') || !config()->has('pdf.font_data')) { return $mpdf_config; } @@ -77,8 +76,8 @@ protected function addCustomFontsConfig($mpdf_config) $fontData = (new Mpdf\Config\FontVariables())->getDefaults()['fontdata']; // Merge default with custom configuration - $mpdf_config['fontDir'] = array_merge($fontDirs, [Config::get('pdf.font_path')]); - $mpdf_config['fontdata'] = array_merge($fontData, Config::get('pdf.font_data')); + $mpdf_config['fontDir'] = array_merge($fontDirs, [config('pdf.font_path')]); + $mpdf_config['fontdata'] = array_merge($fontData, config('pdf.font_data')); return $mpdf_config; } From 592911f736db737b6e0d318d6f1fb7ad02d4eae2 Mon Sep 17 00:00:00 2001 From: Ehsan Kiasaty Date: Tue, 22 Oct 2019 21:07:32 +0330 Subject: [PATCH 3/6] Update PdfServiceProvider.php --- src/LaravelPdf/PdfServiceProvider.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/LaravelPdf/PdfServiceProvider.php b/src/LaravelPdf/PdfServiceProvider.php index 31dbc53..48da21a 100755 --- a/src/LaravelPdf/PdfServiceProvider.php +++ b/src/LaravelPdf/PdfServiceProvider.php @@ -2,7 +2,6 @@ namespace niklasravnsborg\LaravelPdf; -use Illuminate\Support\Facades\Config; use Illuminate\Support\ServiceProvider as BaseServiceProvider; class PdfServiceProvider extends BaseServiceProvider { @@ -23,7 +22,7 @@ class PdfServiceProvider extends BaseServiceProvider { public function boot() { $this->publishes([ - __DIR__ . '/../config/pdf.php' => config_path('pdf.php'), + __DIR__ . '/../config/pdf.php' => app()->basePath('config/pdf.php'), ]); } @@ -38,7 +37,7 @@ public function register() __DIR__ . '/../config/pdf.php', 'pdf' ); - $this->app->bind('mpdf.wrapper', function($app) { + app()->bind('mpdf.wrapper', function($app) { return new PdfWrapper(); }); } From fbf8ddca57f89ed8eeddb7d0bb7017c2a736591d Mon Sep 17 00:00:00 2001 From: Ehsan Kiasaty Date: Tue, 22 Oct 2019 21:08:48 +0330 Subject: [PATCH 4/6] Update PdfWrapper.php --- src/LaravelPdf/PdfWrapper.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/LaravelPdf/PdfWrapper.php b/src/LaravelPdf/PdfWrapper.php index 2e58721..9e68045 100755 --- a/src/LaravelPdf/PdfWrapper.php +++ b/src/LaravelPdf/PdfWrapper.php @@ -3,7 +3,6 @@ namespace niklasravnsborg\LaravelPdf; use File; -use View; class PdfWrapper { @@ -39,7 +38,7 @@ public function loadFile($file, $config = []) */ public function loadView($view, $data = [], $mergeData = [], $config = []) { - return new Pdf(View::make($view, $data, $mergeData)->render(), $config); + return new Pdf(view($view, $data, $mergeData)->render(), $config); } } From 0aad5a9d07e655d026233bce9963911f81d0620f Mon Sep 17 00:00:00 2001 From: Ehsan Kiasaty Date: Wed, 23 Oct 2019 13:22:25 +0330 Subject: [PATCH 5/6] Update composer.json --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d022d7f..d491da6 100755 --- a/composer.json +++ b/composer.json @@ -1,7 +1,8 @@ { - "name": "niklasravnsborg/laravel-pdf", + "name": "kiasaty/lumen-pdf", "description": "Generate PDFs in Laravel with this mPDF wrapper.", "keywords": ["mpdf", "pdf", "laravel"], + "homepage": "https://github.com/kiasaty/lumen-pdf", "license": "MIT", "scripts": { "test": "phpunit --colors=always" From 9733bc0a72fb4eeee71efc684dc20491c58584dd Mon Sep 17 00:00:00 2001 From: Ehsan Kiasaty Date: Wed, 30 Oct 2019 11:16:09 +0330 Subject: [PATCH 6/6] changed File facade to file helper in PdfWrapper.php --- src/LaravelPdf/PdfWrapper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LaravelPdf/PdfWrapper.php b/src/LaravelPdf/PdfWrapper.php index 9e68045..c8c8a6f 100755 --- a/src/LaravelPdf/PdfWrapper.php +++ b/src/LaravelPdf/PdfWrapper.php @@ -25,7 +25,7 @@ public function loadHTML($html, $config = []) */ public function loadFile($file, $config = []) { - return new Pdf(File::get($file), $config); + return new Pdf(file($file), $config); } /**