Render PDF in HTML

This commit is contained in:
David Bomba 2019-08-29 14:58:04 +10:00
parent 2704c179c7
commit 2c65a6305c
3 changed files with 36 additions and 2 deletions

View File

@ -57,7 +57,7 @@ class CreateInvoicePdf
}
private function makePdf($header, $footer, $html, $pdf)
private function makePdf($header, $footer, $html, $pdf) : void
{
Browsershot::html($html)
//->showBrowserHeaderAndFooter()
@ -68,8 +68,20 @@ class CreateInvoicePdf
->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);
}
}

View File

@ -47,6 +47,27 @@ class ClientPresenter extends EntityPresenter
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;
}
}

View File

@ -0,0 +1 @@
{!! $pdf !!}