mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 13:34:36 -04:00
Render PDF in HTML
This commit is contained in:
parent
2704c179c7
commit
2c65a6305c
@ -57,7 +57,7 @@ class CreateInvoicePdf
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function makePdf($header, $footer, $html, $pdf)
|
private function makePdf($header, $footer, $html, $pdf) : void
|
||||||
{
|
{
|
||||||
Browsershot::html($html)
|
Browsershot::html($html)
|
||||||
//->showBrowserHeaderAndFooter()
|
//->showBrowserHeaderAndFooter()
|
||||||
@ -68,8 +68,20 @@ class CreateInvoicePdf
|
|||||||
->savePdf($pdf);
|
->savePdf($pdf);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generateInvoiceHtml($template, $invoice)
|
/**
|
||||||
|
* Generate the HTML invoice parsing variables
|
||||||
|
* and generating the final invoice HTML
|
||||||
|
*
|
||||||
|
* @param string $template either the path to the design template, OR the full design template string
|
||||||
|
* @param Collection $invoice The invoice object
|
||||||
|
* @return string The invoice string in HTML format
|
||||||
|
*/
|
||||||
|
private function generateInvoiceHtml($template, $invoice) :string
|
||||||
{
|
{
|
||||||
|
//swap labels
|
||||||
|
|
||||||
|
$html = view(.$template, $invoice)->render();
|
||||||
|
|
||||||
|
return view('pdf.stub', $html);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,27 @@ class ClientPresenter extends EntityPresenter
|
|||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function shipping_address()
|
||||||
|
{
|
||||||
|
$str = '';
|
||||||
|
$client = $this->entity;
|
||||||
|
|
||||||
|
if ($address1 = $client->shipping_address1) {
|
||||||
|
$str .= e($address1) . '<br/>';
|
||||||
|
}
|
||||||
|
if ($address2 = $client->shipping_address2) {
|
||||||
|
$str .= e($address2) . '<br/>';
|
||||||
|
}
|
||||||
|
if ($cityState = $this->getCityState()) {
|
||||||
|
$str .= e($cityState) . '<br/>';
|
||||||
|
}
|
||||||
|
if ($country = $client->country) {
|
||||||
|
$str .= e($country->name) . '<br/>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
1
resources/views/pdf/stub.blade.php
Normal file
1
resources/views/pdf/stub.blade.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
{!! $pdf !!}
|
Loading…
x
Reference in New Issue
Block a user