- Can I use ACTcpdfBundle in Laravel, or is it only for Symfony?
- This bundle is designed for Symfony, not Laravel. Laravel developers should explore alternatives like **barryvdh/laravel-dompdf** or **spatie/pdf-to-base64**, which are Laravel-native and integrate with Laravel’s service container and Blade/Twig.
- What Laravel versions does ACTcpdfBundle support?
- ACTcpdfBundle is not Laravel-compatible. It’s built for Symfony 3.x (with potential manual adjustments for Symfony 4/5/6). For Laravel, check TCPDF’s standalone PHP library or Laravel-specific PDF packages instead.
- How do I install ACTcpdfBundle in a Symfony project?
- Run `composer require acucchieri/tcpdf-bundle`, then enable the bundle in `config/bundles.php` (Symfony 4+) or `app/AppKernel.php` (Symfony 3.x). No additional configuration is required for basic usage.
- Does ACTcpdfBundle support Twig templates for dynamic PDF content?
- No, the bundle doesn’t natively integrate with Twig. You’ll need to manually render Twig templates to HTML strings and pass them to TCPDF’s `writeHTML()` method. For seamless Twig support, consider alternatives like **knplabs/knp-snappy-bundle** (HTML-to-PDF via wkhtmltopdf).
- Is ACTcpdfBundle secure? Has it patched TCPDF vulnerabilities like CVE-2021-32629?
- The bundle hasn’t been updated since 2021, so it may not include patches for TCPDF vulnerabilities. If security is critical, manually update TCPDF via Composer (`composer require tecnickcom/tcpdf`) or use a maintained alternative like **spatie/pdf-to-base64**, which wraps a patched version.
- How do I generate a PDF and send it as an email attachment in Symfony?
- Use the `attachment()` helper: `$pdfBuilder->attachment('invoice.pdf')` returns a base64-encoded string. Pass this to Symfony’s `Swiftmailer` or `Mailer` component as an email attachment. For inline PDFs, use `$pdfBuilder->inline('document.pdf')` in a controller response.
- What’s the performance like for high-volume PDF generation?
- TCPDF is slower than alternatives like DomPDF or Snappy (wkhtmltopdf). For high-traffic apps, benchmark with tools like **Blackfire** or **Xdebug**. If performance is critical, consider **knplabs/knp-snappy-bundle** for HTML-to-PDF conversion, which leverages faster rendering engines.
- Can I customize fonts or add barcodes in ACTcpdfBundle?
- Yes, but it requires direct TCPDF API knowledge. Use TCPDF’s `AddFont()` or `write2DBarcode()` methods via the `PdfBuilder` instance. The bundle extends TCPDF directly, so all TCPDF features are available. Refer to the [TCPDF documentation](https://tcpdf.org) for advanced use cases.
- How do I test PDF generation in CI/CD pipelines?
- Test PDF output by comparing generated files to golden masters (pre-generated PDFs) using tools like **PHPUnit** and **File::assertEquals()**. For dynamic content, mock data sources (e.g., Doctrine entities) and verify the PDF structure with libraries like **setasign/fpdi** for assertions.
- What are the alternatives to ACTcpdfBundle for Symfony/Laravel?
- For Symfony: **knplabs/knp-snappy-bundle** (HTML-to-PDF via wkhtmltopdf), **spatie/pdf-to-base64** (TCPDF wrapper with Laravel/Symfony support). For Laravel: **barryvdh/laravel-dompdf**, **spatie/pdf-to-base64**, or **mikehaertl/phpwkhtmltopdf** (Snappy wrapper). Choose based on needs: TCPDF for complex layouts, Snappy for HTML fidelity.