acucchieri/tcpdf-bundle
Symfony bundle integrating TCPDF for quick PDF generation and delivery. Build PDFs via a TCPDF-based PdfBuilder and output inline, as download, attachment/base64, string, or save to disk. Includes MultiCell row helper for table-like layouts.
PdfBuilder class extends TCPDF directly, so existing TCPDF knowledge transfers seamlessly.Response, Content-Disposition), making it easy to integrate with controllers, APIs, or CLI commands.writeHTML) can be leveraged, though the bundle itself doesn’t enforce a templating layer (e.g., Twig integration would require custom work).AppKernel is deprecated in favor of Kernel classes (Symfony 4+). The README’s instructions assume legacy Symfony 3.x, requiring manual adjustments for newer versions.autowire: true, config/bundles.php)?/invoices/{id}/pdf).PdfBuilder service, bundle architecture) make it unsuitable for standalone PHP or other frameworks.fopen + TCPDF manual setup) with the bundle’s PdfBuilder.writeHTML, Cell() methods).AppKernel.php to config/bundles.php and ensure autowiring is configured.PdfBuilder is a service, so it can be injected into controllers/services.pdf.generated) for post-processing (e.g., logging, analytics).PdfBuilder).use AC\TcpdfBundle\Pdf\PdfBuilder;
class PdfController extends AbstractController {
public function generate(PdfBuilder $pdf): Response {
$pdf->SetFont('helvetica', 'B', 20);
$pdf->Cell(0, 10, 'Hello, Symfony!', 0, 1, 'C');
return $pdf->inline('hello.pdf');
}
}
writeHTML(), AddPage()) for complex layouts.PdfBuilder via inheritance or decorators.inline() for browser display or download() for attachments.Content-Type: application/pdf).composer.json to avoid unexpected updates.composer why-not acucchieri/tcpdf-bundle to debug compatibility issues.How can I help you explore Laravel packages today?