1. Go to this page and download the library: Download daif/chrome-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/ */
namespace App\Controller;
use Daif\ChromePdfBundle\ChromePdfInterface;
use Symfony\Component\HttpFoundation\Response;
class InvoiceController
{
public function generateInvoice(ChromePdfInterface $chromePdf): Response
{
return $chromePdf->html()
->content('invoice.html.twig', [
'invoice' => $invoice,
])
->generate()
->stream()
;
}
}
use Daif\ChromePdfBundle\ChromePdfInterface;
class ReportController
{
public function generateReport(ChromePdfInterface $chromePdf): Response
{
return $chromePdf->url()
->url('https://example.com/report')
->generate()
->stream()
;
}
}
use Daif\ChromePdfBundle\ChromePdfInterface;
class DocController
{
public function generateDoc(ChromePdfInterface $chromePdf): Response
{
return $chromePdf->markdown()
->wrapper('wrapper.html.twig')
->files('content.md')
->generate()
->stream()
;
}
}
use Daif\ChromePdfBundle\ChromeScreenshotInterface;
class ScreenshotController
{
public function capture(ChromeScreenshotInterface $chromeScreenshot): Response
{
return $chromeScreenshot->html()
->content('page.html.twig')
->generate()
->stream()
;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.