php - Laravel package html to pdf -
i've used following package converting html pdf:
https://github.com/vsmoraes/pdf-laravel5
but when use isn't looking @ all. original html pdf:
and when i've convert it, looks this:
am doing wrong here?
edit:
public function __construct(pdf $pdf) { $this->pdf = $pdf; } public function download() { $html = view('administration.invoice')->render(); return $this->pdf->load($html)->download(); }
this laravel package seems using dompdf great.
having in mind cannot see code share php code that's working me:
// should normal html page $url = 'http://www.website.com/invoice'; $html = file_get_contents($url); // first. convert relative image paths file system paths. // test generated path images files located $html = str_replace("/images", public_path()."/images", $html); // generate pdf file $dompdf = new dompdf(); $dompdf->set_paper("a4", "portrait"); $dompdf->load_html($html); $dompdf->render(); $dompdf->stream('your_invoice_file.pdf');
if want render laravel view directly pdf replace first 2 lines of code one
// render view $html = view::make('path/view');
alternative option given code have added
$html = view('administration.invoice')->render(); $html = str_replace("/images", public_path()."/images", $html); return $this->pdf->load($html)->download();
remember set images folder 1 have.
Comments
Post a Comment