1. Go to this page and download the library: Download kwizer15/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/ */
kwizer15 / pdf-bundle example snippets
bash
$ php composer.phar update
php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Kwizer\PdfBundle\KwizerPdfBundle(),
);
}
php
// src/Acme/DemoBundle/PdfDocument/MyPdf.php
namespace Acme\DemoBundle\PdfDocument;
class MyDocument extends \Kwizer\PdfBundle\Core\AbstractPdfDocument
{
public function buildContent()
{
$this->builder->cell('Hello World !!!');
}
}
php
// src/Acme/DemoBundle/Controller/MyController.php
...
use Symfony\Component\HttpFoundation\Response;
use Acme\DemoBundle\PdfDocument\MyDocument;
class MyController extends Controller
{
public function myAction()
{
$response = new Response();
$response->headers->set('Content-Type', 'application/pdf');
$response->headers->set('Content-Disposition', 'inline; filename=my.pdf');
$pdf = $this->get('kwizer.pdf.factory')->createPdf(new MyDocument());
$response->setContent($pdf);
return $response;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.