I am using Laravel 5.5 for developing Application, For The Generation of PDF I am using laravel dompdf Package Here is Link: https://github.com/barryvdh/laravel-dompdf I was already Created issue on Github for this .
Here is My Laravel Code:
public function ViewPDF($id)
{
$product = Product::find($id);
$category = Category::find($product->category_id);
$product_line = ProductLine::find($product->product_line_id);
$template = View('product_and_category/PDF_Template', ['data'=>$product]);
return $this->GeneratePDF($template);
}
public function GeneratePDF($html) {
$pdf = \App::make('dompdf.wrapper');
$pdf->loadHTML($html);
return $pdf->stream();
}
Here is HTML , I have Already Added the UTF-8 in My HTML, But still having the same issue its looking like bug in the package.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Title</title>
</head>
<body style="margin:0px;">
<section style="width:100%; margin:0; text-align:center;">
<div style="background:url({{asset('/images/red-nav-bg.jpg') }}) repeat-x 0px 68px #702425;">
<img src="{{ asset('/images/logo.png') }}" width="auto" height="auto" alt="logo" />
</div>
</section> <!---**** Section Close ****--->
<div style="width:1100px; margin:30px auto; text-align:center;">
<img src="assets/images/doorImg2.jpg" width="auto" height="auto" alt="logo" style="padding: 30px 40px; border: 1px solid #cdced1;" />
</div>
<div style="width:1100px; margin:0 auto;">
<table width="100%" border="1" cellspacing="0" cellpadding="10" style="margin-bottom:30px; font-size:14px; border-color:#cdced1; font-family:sans-serif;">
<tr>
<td>Category</td>
<td>adsfdsaf</td>
</tr>
<tr>
<td>Product Line</td>
<td>Draft beer systems & refrugeration</td>
</tr>
<tr>
<td>Model #</td>
<td>D-36-18RL</td>
</tr>
<tr>
<td>Description</td>
<td>36" L x 18"D stainless steel sink</td>
</tr>
<tr>
<td>Cost</td>
<td>$</td>
</tr>
<tr>
<td>Number of Faucets</td>
<td>8</td>
</tr>
<tr>
<td>Material Finishes</td>
<td>QF_Metal - Mirror - Finished</td>
</tr>
<tr>
<td>Dimension</td>
<td>15 7/8</td>
</tr>
</table>
</div>
<div style="width:100%; margin:0 auto; background-color:#f9f9f9; text-align:center; padding:30px 0px; font-size:13px; color: #ccc; font-family:sans-serif;">
<p style="margin: 0px;">© 2017 Copyrights</p>
</div> <!---**** Footer Close ****--->
</body>
</html>
Some HTML Tags are not encoded in DOMPDF that's why i was facing this error after some clean up in html template working fine