mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Fix PDF on older IE
This commit is contained in:
parent
d7373a133b
commit
0b90e6e512
@ -200,7 +200,8 @@ class ClientPortalController extends BaseController
|
||||
}
|
||||
|
||||
$invoice = $invitation->invoice;
|
||||
$pdfString = $invoice->getPDFString();
|
||||
$decode = ! request()->base64;
|
||||
$pdfString = $invoice->getPDFString($decode);
|
||||
|
||||
header('Content-Type: application/pdf');
|
||||
header('Content-Length: ' . strlen($pdfString));
|
||||
|
@ -1231,7 +1231,7 @@ class Invoice extends EntityModel implements BalanceAffecting
|
||||
/**
|
||||
* @return bool|string
|
||||
*/
|
||||
public function getPDFString()
|
||||
public function getPDFString($decode = true)
|
||||
{
|
||||
if (! env('PHANTOMJS_CLOUD_KEY') && ! env('PHANTOMJS_BIN_PATH')) {
|
||||
return false;
|
||||
@ -1271,11 +1271,15 @@ class Invoice extends EntityModel implements BalanceAffecting
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($pdf = Utils::decodePDF($pdfString)) {
|
||||
return $pdf;
|
||||
if ($decode) {
|
||||
if ($pdf = Utils::decodePDF($pdfString)) {
|
||||
return $pdf;
|
||||
} else {
|
||||
Utils::logError("PhantomJS - Unable to decode: {$pdfString}");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
Utils::logError("PhantomJS - Unable to decode: {$pdfString}");
|
||||
return false;
|
||||
return $pdfString;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,25 @@
|
||||
var needsRefresh = false;
|
||||
|
||||
function refreshPDF(force) {
|
||||
return getPDFString(refreshPDFCB, force);
|
||||
try {
|
||||
return getPDFString(refreshPDFCB, force);
|
||||
} catch (exception) {
|
||||
$.get('http://ninja.dev/download/kamdswrgu9adbmojwlvmsfyzc6a3zd42?base64=true', function(result) {
|
||||
refreshPDFCB(result);
|
||||
})
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
@if (true || isset($usePhantomJS) && $usePhantomJS)
|
||||
$.get('http://ninja.dev/download/kamdswrgu9adbmojwlvmsfyzc6a3zd42?base64=true', function(result) {
|
||||
refreshPDFCB(result);
|
||||
})
|
||||
return false;
|
||||
@else
|
||||
return getPDFString(refreshPDFCB, force);
|
||||
@endif
|
||||
*/
|
||||
}
|
||||
|
||||
function refreshPDFCB(string) {
|
||||
|
Loading…
Reference in New Issue
Block a user