diff --git a/resources/views/invoices/pdf.blade.php b/resources/views/invoices/pdf.blade.php index c36257bdab5a..52185f45b7ce 100644 --- a/resources/views/invoices/pdf.blade.php +++ b/resources/views/invoices/pdf.blade.php @@ -118,26 +118,12 @@ return getPDFString(refreshPDFCB, force); } catch (exception) { if (location.href.indexOf('/view/')) { - var url = location.href.replace('/view/', '/download/') + '?base64=true&silent=true'; + var url = location.href.replace('/view/', '/download/') + '?base64=true'; $.get(url, function(result) { refreshPDFCB(result); }) } } - /* - @if (true || isset($usePhantomJS) && $usePhantomJS) - console.log(location.href); - console.log(location.href.indexOf('/view/')); - console.log(); - return false; - $.get('http://ninja.dev/download/...?base64=true', function(result) { - refreshPDFCB(result); - }) - return false; - @else - return getPDFString(refreshPDFCB, force); - @endif - */ } function refreshPDFCB(string) { diff --git a/resources/views/invoices/view.blade.php b/resources/views/invoices/view.blade.php index a1b1bd9d7b85..c6e529a49508 100644 --- a/resources/views/invoices/view.blade.php +++ b/resources/views/invoices/view.blade.php @@ -237,9 +237,15 @@ }); function onDownloadClick() { - var doc = generatePDF(invoice, invoice.invoice_design.javascript, true); - var fileName = invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice; - doc.save(fileName + '-' + invoice.invoice_number + '.pdf'); + try { + var doc = generatePDF(invoice, invoice.invoice_design.javascript, true); + var fileName = invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice; + doc.save(fileName + '-' + invoice.invoice_number + '.pdf'); + } catch (exception) { + if (location.href.indexOf('/view/')) { + location.href = location.href.replace('/view/', '/download/'); + } + } } function showCustomModal() {