1. Go to this page and download the library: Download pmarien/html-to-pdf-bundle 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/ */
pmarien / html-to-pdf-bundle example snippets
public function showAction(\PMA\HtmlToPdfBundle\Bridge\FoundationBridge $generator):\Symfony\Component\HttpFoundation\Response{
return $generator->inlineResponse(
'test.pdf',
'<html><body><p>This is a test!</p></body></html>'
);
}
public function downloadAction(\PMA\HtmlToPdfBundle\Bridge\FoundationBridge $generator):\Symfony\Component\HttpFoundation\Response{
return $generator->attachmentResponse(
'test.pdf',
'<html><body><p>This is a test!</p></body></html>'
);
}
public function storeFile(\PMA\HtmlToPdfBundle\Bridge\FoundationBridge $generator):void {
$generator->createFile(
'/your/project/file-storage/test.pdf',
'<html><body><p>This is a test!</p></body></html>'
);
}
public function showAction(\PMA\HtmlToPdfBundle\Bridge\TwigBridge $generator):\Symfony\Component\HttpFoundation\Response{
return $generator->inlineResponse(
'test.pdf',
'pdf-templates/test.pdf.twig',
[
'test'=>'Test'
]
);
}
public function downloadAction(\PMA\HtmlToPdfBundle\Bridge\TwigBridge $generator):\Symfony\Component\HttpFoundation\Response{
return $generator->attachmentResponse(
'test.pdf',
'pdf-templates/test.pdf.twig',
[
'test'=>'Test'
]
);
}
public function storeFile(\PMA\HtmlToPdfBundle\Bridge\TwigBridge $generator):void {
$generator->createFile(
'/your/project/file-storage/test.pdf',
'pdf-templates/test.pdf.twig',
[
'test'=>'Test'
]
);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.