mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 19:04:41 -04:00
Merge pull request #6751 from turbo124/v5-develop
Add a fallback PDF generator if one fails
This commit is contained in:
commit
5f6fa2371a
@ -170,6 +170,15 @@ class CreateRawPdf implements ShouldQueue
|
|||||||
|
|
||||||
if(config('ninja.invoiceninja_hosted_pdf_generation') || config('ninja.pdf_generator') == 'hosted_ninja'){
|
if(config('ninja.invoiceninja_hosted_pdf_generation') || config('ninja.pdf_generator') == 'hosted_ninja'){
|
||||||
$pdf = (new NinjaPdf())->build($maker->getCompiledHTML(true));
|
$pdf = (new NinjaPdf())->build($maker->getCompiledHTML(true));
|
||||||
|
|
||||||
|
$finfo = new \finfo(FILEINFO_MIME);
|
||||||
|
|
||||||
|
//fallback in case hosted PDF fails.
|
||||||
|
if($finfo->buffer($pdf) != 'application/pdf; charset=binary')
|
||||||
|
{
|
||||||
|
$pdf = $this->makePdf(null, null, $maker->getCompiledHTML(true));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$pdf = $this->makePdf(null, null, $maker->getCompiledHTML(true));
|
$pdf = $this->makePdf(null, null, $maker->getCompiledHTML(true));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user