1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Enabled downloading PDF through route

This commit is contained in:
Hillel Coren 2016-02-17 21:13:55 +02:00
parent cc27e5278f
commit ed941fef89
3 changed files with 10 additions and 4 deletions

View File

@ -174,7 +174,13 @@ class PublicClientController extends BaseController
$invoice = $invitation->invoice; $invoice = $invitation->invoice;
$pdfString = $invoice->getPDFString(); $pdfString = $invoice->getPDFString();
dd($pdfString); header('Content-Type: application/pdf');
header('Content-Length: ' . strlen($pdfString));
header('Content-disposition: attachment; filename="' . $invoice->getFileName() . '"');
header('Cache-Control: public, must-revalidate, max-age=0');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
return $pdfString;
} }
public function dashboard() public function dashboard()

View File

@ -750,7 +750,7 @@ class Invoice extends EntityModel implements BalanceAffecting
return false; return false;
} }
return $pdfString; return Utils::decodePDF($pdfString);
} }
} }

View File

@ -56,7 +56,7 @@ class ContactMailer extends Mailer
$sent = false; $sent = false;
if ($account->attatchPDF() && !$pdfString) { if ($account->attatchPDF() && !$pdfString) {
$pdfString = Utils::decodePDF($invoice->getPDFString()); $pdfString = $invoice->getPDFString();
} }
foreach ($invoice->invitations as $invitation) { foreach ($invoice->invitations as $invitation) {
@ -184,7 +184,7 @@ class ContactMailer extends Mailer
]; ];
if ($account->attatchPDF()) { if ($account->attatchPDF()) {
$data['pdfString'] = Utils::decodePDF($invoice->getPDFString()); $data['pdfString'] = $invoice->getPDFString();
$data['pdfFileName'] = $invoice->getFileName(); $data['pdfFileName'] = $invoice->getFileName();
} }