Reputation: 381
I have following view
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
</head>
<body>
<ul class="nav nav-tabs">
<li role="presentation" class="active"><a href="#">Home</a></li>
<li role="presentation"><a href="#">Profile</a></li>
<li role="presentation"><a href="#">Messages</a></li>
</ul>
<form>
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Email">
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</body>
</html>
And used following code to generate pdf file
public function pdf()
{
$view = view()->make('Article::print');
$contents = $view->render();
$pdf = PDF::loadHTML($contents)->setPaper('a4', 'landscape')->setWarnings(false);
return $pdf->download('santosh.pdf');
}
But it does not give correct output rather it return
How can i solve it , please help
Upvotes: 3
Views: 2553
Reputation: 21
You cannot pdf with complex design but you do can create pdf with simple design having simple css.
Upvotes: 2
Reputation: 13924
The current release of Dompdf (0.7.0) has limited support for Bootstrap-based styling (see the relevant issue). With the 0.7.1 Dompdf will come closer to being able to render your document, but I would still not recommend it until the following release (0.7.2?) because it is still missing some necessary capability with regard to the box-sizing CSS property.
Upvotes: 0
Reputation: 515
DomPDF supports limited number CSS items. If you need to complex html into PDF, please use wkhtml2pdf. It gives better output
Upvotes: 1