mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Add inline download capability
This commit is contained in:
parent
3d28159702
commit
6c1b0c24d0
@ -589,14 +589,20 @@ class CreditController extends BaseController
|
||||
public function downloadPdf($invitation_key)
|
||||
{
|
||||
$invitation = $this->credit_repository->getInvitationByKey($invitation_key);
|
||||
// $contact = $invitation->contact;
|
||||
|
||||
$credit = $invitation->credit;
|
||||
|
||||
$file = $credit->service()->getCreditPdf($invitation);
|
||||
|
||||
$headers = ['Content-Type' => 'application/pdf'];
|
||||
|
||||
if(request()->input('inline') == 'true')
|
||||
$headers = array_merge($headers, ['Content-Disposition' => 'inline']);
|
||||
|
||||
return response()->streamDownload(function () use($file) {
|
||||
echo Storage::get($file);
|
||||
}, basename($file), ['Content-Type' => 'application/pdf']);
|
||||
}, basename($file), $headers);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -804,9 +804,15 @@ class InvoiceController extends BaseController
|
||||
|
||||
$file = $invoice->service()->getInvoicePdf($contact);
|
||||
|
||||
$headers = ['Content-Type' => 'application/pdf'];
|
||||
|
||||
if(request()->input('inline') == 'true')
|
||||
$headers = array_merge($headers, ['Content-Disposition' => 'inline']);
|
||||
|
||||
return response()->streamDownload(function () use($file) {
|
||||
echo Storage::get($file);
|
||||
}, basename($file), ['Content-Type' => 'application/pdf']);
|
||||
}, basename($file), $headers);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -740,11 +740,16 @@ class QuoteController extends BaseController
|
||||
|
||||
$file = $quote->service()->getQuotePdf($contact);
|
||||
|
||||
$headers = ['Content-Type' => 'application/pdf'];
|
||||
|
||||
if(request()->input('inline') == 'true')
|
||||
$headers = array_merge($headers, ['Content-Disposition' => 'inline']);
|
||||
|
||||
return response()->streamDownload(function () use($file) {
|
||||
echo Storage::get($file);
|
||||
}, basename($file), ['Content-Type' => 'application/pdf']);
|
||||
}, basename($file), $headers);
|
||||
|
||||
|
||||
// return response()->download($file_path, basename($file_path), ['Cache-Control:' => 'no-cache'])->deleteFileAfterSend(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user