mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04: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;
|
$invoice = $invitation->invoice;
|
||||||
$pdfString = $invoice->getPDFString();
|
$decode = ! request()->base64;
|
||||||
|
$pdfString = $invoice->getPDFString($decode);
|
||||||
|
|
||||||
header('Content-Type: application/pdf');
|
header('Content-Type: application/pdf');
|
||||||
header('Content-Length: ' . strlen($pdfString));
|
header('Content-Length: ' . strlen($pdfString));
|
||||||
|
@ -1231,7 +1231,7 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
/**
|
/**
|
||||||
* @return bool|string
|
* @return bool|string
|
||||||
*/
|
*/
|
||||||
public function getPDFString()
|
public function getPDFString($decode = true)
|
||||||
{
|
{
|
||||||
if (! env('PHANTOMJS_CLOUD_KEY') && ! env('PHANTOMJS_BIN_PATH')) {
|
if (! env('PHANTOMJS_CLOUD_KEY') && ! env('PHANTOMJS_BIN_PATH')) {
|
||||||
return false;
|
return false;
|
||||||
@ -1271,11 +1271,15 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pdf = Utils::decodePDF($pdfString)) {
|
if ($decode) {
|
||||||
return $pdf;
|
if ($pdf = Utils::decodePDF($pdfString)) {
|
||||||
|
return $pdf;
|
||||||
|
} else {
|
||||||
|
Utils::logError("PhantomJS - Unable to decode: {$pdfString}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Utils::logError("PhantomJS - Unable to decode: {$pdfString}");
|
return $pdfString;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,25 @@
|
|||||||
var needsRefresh = false;
|
var needsRefresh = false;
|
||||||
|
|
||||||
function refreshPDF(force) {
|
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) {
|
function refreshPDFCB(string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user