mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-02 19:04:33 -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
|
.php_cs.cache
|
||||||
public/test.pdf
|
public/test.pdf
|
||||||
|
public/storage/test.pdf
|
||||||
|
@ -21,6 +21,7 @@ use App\Models\Account;
|
|||||||
use App\Utils\CurlUtils;
|
use App\Utils\CurlUtils;
|
||||||
use App\Utils\SystemHealth;
|
use App\Utils\SystemHealth;
|
||||||
use App\Utils\Traits\AppSetup;
|
use App\Utils\Traits\AppSetup;
|
||||||
|
use Beganovich\ChromiumPdf\ChromiumPdf;
|
||||||
use DB;
|
use DB;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Contracts\Foundation\Application;
|
use Illuminate\Contracts\Foundation\Application;
|
||||||
@ -227,15 +228,26 @@ class SetupController extends Controller
|
|||||||
return $this->testPhantom();
|
return $this->testPhantom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config('ninja.experimental_pdf_engine')) {
|
||||||
|
$chromium_pdf = new ChromiumPdf();
|
||||||
|
|
||||||
|
$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!')
|
Browsershot::html('GENERATING PDFs WORKS! Thank you for using Invoice Ninja!')
|
||||||
->setNodeBinary(config('ninja.system.node_path'))
|
->setNodeBinary(config('ninja.system.node_path'))
|
||||||
->setNpmBinary(config('ninja.system.npm_path'))
|
->setNpmBinary(config('ninja.system.npm_path'))
|
||||||
->noSandbox()
|
->noSandbox()
|
||||||
->savePdf(
|
->savePdf(
|
||||||
public_path('test.pdf')
|
public_path('storage/test.pdf')
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return response(['url' => asset('test.pdf')], 200);
|
return response(['url' => asset('storage/test.pdf')], 200);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
info($e->getMessage());
|
info($e->getMessage());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user