mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Enable support for ChromiumPdf on setup
Add test.pdf to .gitignore
This commit is contained in:
parent
e6419085b2
commit
9f4481d35f
1
.gitignore
vendored
1
.gitignore
vendored
@ -28,3 +28,4 @@ nbproject
|
||||
|
||||
.php_cs.cache
|
||||
public/test.pdf
|
||||
public/storage/test.pdf
|
||||
|
@ -21,6 +21,7 @@ use App\Models\Account;
|
||||
use App\Utils\CurlUtils;
|
||||
use App\Utils\SystemHealth;
|
||||
use App\Utils\Traits\AppSetup;
|
||||
use Beganovich\ChromiumPdf\ChromiumPdf;
|
||||
use DB;
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
@ -227,15 +228,26 @@ class SetupController extends Controller
|
||||
return $this->testPhantom();
|
||||
}
|
||||
|
||||
Browsershot::html('GENERATING PDFs WORKS! Thank you for using Invoice Ninja!')
|
||||
->setNodeBinary(config('ninja.system.node_path'))
|
||||
->setNpmBinary(config('ninja.system.npm_path'))
|
||||
->noSandbox()
|
||||
->savePdf(
|
||||
public_path('test.pdf')
|
||||
);
|
||||
if (config('ninja.experimental_pdf_engine')) {
|
||||
$chromium_pdf = new ChromiumPdf();
|
||||
|
||||
return response(['url' => asset('test.pdf')], 200);
|
||||
$pdf = $chromium_pdf
|
||||
->setChromiumPath(config('ninja.experimental_pdf_engine_chromium_path'))
|
||||
->setHtml('GENERATING PDFs WORKS! Thank you for using Invoice Ninja!')
|
||||
->generate();
|
||||
|
||||
Storage::put('public/test.pdf', $pdf);
|
||||
} else {
|
||||
Browsershot::html('GENERATING PDFs WORKS! Thank you for using Invoice Ninja!')
|
||||
->setNodeBinary(config('ninja.system.node_path'))
|
||||
->setNpmBinary(config('ninja.system.npm_path'))
|
||||
->noSandbox()
|
||||
->savePdf(
|
||||
public_path('storage/test.pdf')
|
||||
);
|
||||
}
|
||||
|
||||
return response(['url' => asset('storage/test.pdf')], 200);
|
||||
} catch (Exception $e) {
|
||||
info($e->getMessage());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user