1. Go to this page and download the library: Download smachara/html2pdfbundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
smachara / html2pdfbundle example snippets
public function printAction()
{
$pdf = $this->get('html2pdf_factory')->create();
$html = $this->renderView('PdfBundle:Pdf:content.html.twig', array( 'preview' => false));
$pdf->writeHTML($html);
$response = new Response($pdf->Output('test.pdf','D'));
return $response;
}