1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

pdf download fixed

This commit is contained in:
sigitas 2015-04-17 11:18:58 +03:00
parent ead19c72f7
commit a264f5ecb7
9 changed files with 33 additions and 18 deletions

View File

@ -13,7 +13,7 @@ return [
|
*/
'debug' => env('APP_DEBUG', ''),
'debug' => env('APP_DEBUG', 'true'),
/*
|--------------------------------------------------------------------------

View File

@ -2875,4 +2875,4 @@ body.modal-open { overflow:inherit; padding-right:inherit !important; }
div.checkbox > label {
padding-left: 0px !important;
}
}

View File

@ -31832,11 +31832,15 @@ function generatePDF(invoice, javascript, force, cb) {
invoiceOld = invoice;
report_id = invoice.invoice_design_id;
if(javascript.slice(0, pdfmakeMarker.length) === pdfmakeMarker) {
GetPdfMake(invoice, javascript, cb);
doc = GetPdfMake(invoice, javascript, cb);
//doc.getDataUrl(cb);
} else {
doc = GetPdf(invoice, javascript);
cb( doc.output("datauristring"));
doc.getDataUrl = function(cb) {
cb( this.output("datauristring"));
};
}
return doc;
}
function copyInvoice(orig) {
@ -33366,9 +33370,10 @@ function GetPdfMake(invoice, javascript, callback) {
var account = invoice.account;
eval(javascript);
doc = pdfMake.createPdf(dd);
doc.getDataUrl(callback);
return;
doc.save = function(fileName) {
this.download(fileName);
};
return doc;
}
function notesAndTerms(invoice)
{

View File

@ -2,9 +2,10 @@ function GetPdfMake(invoice, javascript, callback) {
var account = invoice.account;
eval(javascript);
doc = pdfMake.createPdf(dd);
doc.getDataUrl(callback);
return;
doc.save = function(fileName) {
this.download(fileName);
};
return doc;
}
function notesAndTerms(invoice)
{

View File

@ -19,11 +19,15 @@ function generatePDF(invoice, javascript, force, cb) {
invoiceOld = invoice;
report_id = invoice.invoice_design_id;
if(javascript.slice(0, pdfmakeMarker.length) === pdfmakeMarker) {
GetPdfMake(invoice, javascript, cb);
doc = GetPdfMake(invoice, javascript, cb);
//doc.getDataUrl(cb);
} else {
doc = GetPdf(invoice, javascript);
cb( doc.output("datauristring"));
doc.getDataUrl = function(cb) {
cb( this.output("datauristring"));
};
}
return doc;
}
function copyInvoice(orig) {

View File

@ -35,7 +35,8 @@
NINJA.primaryColor = $('#primary_color').val();
NINJA.secondaryColor = $('#secondary_color').val();
generatePDF(invoice, getDesignJavascript(), true, cb);
doc = generatePDF(invoice, getDesignJavascript(), true);
doc.getDataUrl(cb);
}
$(function() {

View File

@ -704,7 +704,8 @@
var invoice = createInvoiceModel();
var design = getDesignJavascript();
if (!design) return;
generatePDF(invoice, design, false, cb);
doc = generatePDF(invoice, design, false);
doc.getDataUrl(cb);
}
function getDesignJavascript() {
@ -743,7 +744,8 @@
var design = getDesignJavascript();
if (!design) return;
generatePDF(invoice, design, true, function(pdfString){
doc = generatePDF(invoice, design, true);
doc.getDataUrl( function(pdfString){
$('form.form-horizontal.warn-on-exit').append('<input type="hidden" name="pdfupload" value="'+pdfString+'">');
submitAction('');
});

View File

@ -32,7 +32,8 @@
invoiceDesign = invoiceDesigns[0];
}
generatePDF(invoice, invoiceDesign.javascript, true, cb);
doc = generatePDF(invoice, invoiceDesign.javascript, true);
doc.getDataUrl(cb);
}
$(function() {

View File

@ -48,7 +48,8 @@
invoice.contact = {!! $contact->toJson() !!};
function getPDFString(cb) {
generatePDF(invoice, invoice.invoice_design.javascript, cb);
doc = generatePDF(invoice, invoice.invoice_design.javascript);
doc.getDataUrl(cb);
}
$(function() {
@ -57,7 +58,7 @@
function onDownloadClick() {
var doc = generatePDF(invoice, invoice.invoice_design.javascript, true);
var fileName = invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice;
var fileName = invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice;
doc.save(fileName + '-' + invoice.invoice_number + '.pdf');
}