1. Go to this page and download the library: Download wucdbm/pdf-generator-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/ */
wucdbm / pdf-generator-bundle example snippets
public function registerBundles() {
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
// Add WucdbmPdfGeneratorBundle to your AppKernel
new \Wucdbm\Bundle\PdfGeneratorBundle\WucdbmPdfGeneratorBundle(),
];
}
/** @var \Wucdbm\Bundle\PdfGeneratorBundle\Generator\PdfGenerator $generator */
$generator = $container->get('wucdbm_pdf_generator.generator');
$filename = 'someFile.pdf';
// Get a PdfResult. The wkPrint and bootstrap methods both return a PdfResult
/** @var \Wucdbm\Bundle\PdfGeneratorBundle\Generator\PdfResult $result */
$result = $generator->wkPrint($html);
// The PdfResult is the result of the PDF generation. It has access to the temporary PDF file
$tempPdfPath = $result->realPath();
// return a Symfony Response
return $generator->bootstrap($html)->response($filename);
// return a Symfony Response and copy the file some place else
// The Generator does NOT save the files; it will unlink them as soon as the request is finished
// The copy() method returns PrintResult
return $generator->bootstrap($html)->copy('/some/location/someFile.pdf')->response($filename);
// And last, you can also get the PDF file contents as string
$contents = $generator->bootstrap($html)->contents();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.