phplaravelphpwkhtmltopdf

is there a way to include a blade template instead of plain html using phpwkhtmltopdf?


I am using phpwkhtmltopdf package to convert my html to PDF. how can i convert .blade.php to pdf?

i tried this

$pdf = new Pdf;
$pdf->addPage('temp');
$pdf->saveAs('test2.pdf');

but it does't work and give me the following error :

QSslSocket: cannot resolve SSLv3_client_method QSslSocket: cannot resolve SSLv3_server_method Error: Failed loading page http:///var/www/html/project/views/temp (sometimes it will work just to ignore this error with --load-error-handling ignore) Exit with code 1 due to network error: HostNotFoundError


Solution

  • ok i found the solution , you can just use View() , like this

    $pdf->addPage(View('temp'));
    

    or

    $view= view('temp')->render();
    $pdf->addPage($view);