refs #762 changes all pdf to html render
This commit is contained in:
parent
92aa7f7ab3
commit
e3207d647e
@ -92,9 +92,7 @@ class Invoices extends Controller
|
|||||||
{
|
{
|
||||||
$invoice = $this->prepareInvoice($invoice);
|
$invoice = $this->prepareInvoice($invoice);
|
||||||
|
|
||||||
$logo = $this->getLogo();
|
return view($invoice->template_path, compact('invoice'));
|
||||||
|
|
||||||
return view($invoice->template_path, compact('invoice', 'logo'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,9 +106,8 @@ class Invoices extends Controller
|
|||||||
{
|
{
|
||||||
$invoice = $this->prepareInvoice($invoice);
|
$invoice = $this->prepareInvoice($invoice);
|
||||||
|
|
||||||
$logo = $this->getLogo();
|
$view = view($invoice->template_path, compact('invoice'))->render();
|
||||||
|
$html = mb_convert_encoding($view, 'HTML-ENTITIES');
|
||||||
$html = view($invoice->template_path, compact('invoice', 'logo'))->render();
|
|
||||||
|
|
||||||
$pdf = \App::make('dompdf.wrapper');
|
$pdf = \App::make('dompdf.wrapper');
|
||||||
$pdf->loadHTML($html);
|
$pdf->loadHTML($html);
|
||||||
@ -147,41 +144,6 @@ class Invoices extends Controller
|
|||||||
return $invoice;
|
return $invoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getLogo()
|
|
||||||
{
|
|
||||||
$logo = '';
|
|
||||||
|
|
||||||
$media_id = setting('general.company_logo');
|
|
||||||
|
|
||||||
if (setting('general.invoice_logo')) {
|
|
||||||
$media_id = setting('general.invoice_logo');
|
|
||||||
}
|
|
||||||
|
|
||||||
$media = Media::find($media_id);
|
|
||||||
|
|
||||||
if (!empty($media)) {
|
|
||||||
$path = Storage::path($media->getDiskPath());
|
|
||||||
|
|
||||||
if (!is_file($path)) {
|
|
||||||
return $logo;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$path = asset('public/img/company.png');
|
|
||||||
}
|
|
||||||
|
|
||||||
$image = Image::make($path)->encode()->getEncoded();
|
|
||||||
|
|
||||||
if (empty($image)) {
|
|
||||||
return $logo;
|
|
||||||
}
|
|
||||||
|
|
||||||
$extension = File::extension($path);
|
|
||||||
|
|
||||||
$logo = 'data:image/' . $extension . ';base64,' . base64_encode($image);
|
|
||||||
|
|
||||||
return $logo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function link(Invoice $invoice, Request $request)
|
public function link(Invoice $invoice, Request $request)
|
||||||
{
|
{
|
||||||
if (empty($invoice)) {
|
if (empty($invoice)) {
|
||||||
|
@ -348,7 +348,8 @@ class Bills extends Controller
|
|||||||
|
|
||||||
$currency_style = true;
|
$currency_style = true;
|
||||||
|
|
||||||
$html = view($bill->template_path, compact('bill', 'currency_style'))->render();
|
$view = view($bill->template_path, compact('bill', 'currency_style'))->render();
|
||||||
|
$html = mb_convert_encoding($view, 'HTML-ENTITIES');
|
||||||
|
|
||||||
$pdf = \App::make('dompdf.wrapper');
|
$pdf = \App::make('dompdf.wrapper');
|
||||||
$pdf->loadHTML($html);
|
$pdf->loadHTML($html);
|
||||||
|
@ -349,7 +349,8 @@ class Invoices extends Controller
|
|||||||
|
|
||||||
$invoice = $this->prepareInvoice($invoice);
|
$invoice = $this->prepareInvoice($invoice);
|
||||||
|
|
||||||
$html = mb_convert_encoding(view($invoice->template_path, compact('invoice'))->render(), 'HTML-ENTITIES');
|
$view = view($invoice->template_path, compact('invoice'))->render();
|
||||||
|
$html = mb_convert_encoding($view, 'HTML-ENTITIES');
|
||||||
|
|
||||||
$pdf = \App::make('dompdf.wrapper');
|
$pdf = \App::make('dompdf.wrapper');
|
||||||
$pdf->loadHTML($html);
|
$pdf->loadHTML($html);
|
||||||
@ -420,7 +421,8 @@ class Invoices extends Controller
|
|||||||
|
|
||||||
$currency_style = true;
|
$currency_style = true;
|
||||||
|
|
||||||
$html = view($invoice->template_path, compact('invoice', 'currency_style'))->render();
|
$view = view($invoice->template_path, compact('invoice', 'currency_style'))->render();
|
||||||
|
$html = mb_convert_encoding($view, 'HTML-ENTITIES');
|
||||||
|
|
||||||
$pdf = app('dompdf.wrapper');
|
$pdf = app('dompdf.wrapper');
|
||||||
$pdf->loadHTML($html);
|
$pdf->loadHTML($html);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user