1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #4576 from beganovich/v5-snappdf-integration-with-windows-and-mac

(v5) Add support for custom Chromium path (ie. support for Windows & Mac)
This commit is contained in:
Benjamin Beganović 2020-12-25 17:18:45 +01:00 committed by GitHub
commit d570cd7474
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 5 deletions

View File

@ -221,9 +221,13 @@ class SetupController extends Controller
return $this->testPhantom();
}
$snappdf = new Snappdf();
$pdf = new Snappdf();
$pdf = $snappdf
if (config('ninja.snappdf_chromium_path')) {
$pdf->setChromiumPath(config('ninja.snappdf_chromium_path'));
}
$pdf = $pdf
->setHtml('GENERATING PDFs WORKS! Thank you for using Invoice Ninja!')
->generate();

View File

@ -29,6 +29,10 @@ trait PdfMaker
{
$pdf = new Snappdf();
if (config('ninja.snappdf_chromium_path')) {
$pdf->setChromiumPath(config('ninja.snappdf_chromium_path'));
}
return $pdf
->setHtml($html)
->generate();

View File

@ -137,4 +137,5 @@ return [
],
'log_pdf_html' => env('LOG_PDF_HTML', false),
'expanded_logging' => env('EXPANDED_LOGGING', false),
'snappdf_chromium_path' => env('SNAPPDF_CHROMIUM_PATH', false),
];

View File

@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@ -8,6 +9,7 @@
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Pdf;
use Beganovich\Snappdf\Snappdf;
@ -26,9 +28,13 @@ class PdfGenerationTest extends TestCase
public function testPdfGeneration()
{
$snappdf = new Snappdf();
$pdf = new Snappdf();
$pdf = $snappdf
if (config('ninja.snappdf_chromium_path')) {
$pdf->setChromiumPath(config('ninja.snappdf_chromium_path'));
}
$pdf = $pdf
->setHtml('<h1>Invoice Ninja</h1>')
->generate();