url() functions in wkhtmltopdf).knplabs/knp-snappy-bundle to composer.json and configure config/packages/knp_snappy.yaml:
knp_snappy:
pdf:
enabled: true
binary: '/usr/local/bin/wkhtmltopdf'
options: []
image:
enabled: true
binary: '/usr/local/bin/wkhtmltoimage'
options: []
SnappyPdf service in a domain-specific service (e.g., InvoicePdfGenerator) to abstract engine details.class InvoicePdfGenerator {
public function __construct(private SnappyPdf $snappyPdf) {}
public function generate(Invoice $invoice): string {
return $this->snappyPdf->getOutputFromHtml(
$this->twig->render('invoices/pdf.html.twig', ['invoice' => $invoice]),
'invoice.pdf'
);
}
}
$message = new GeneratePdfMessage($invoiceId, 'invoice.pdf');
$bus->dispatch($message);
asset() or relative URLs).@media print) for PDF-specific styling.knplabs/knp-snappy-bundle for breaking changes (MIT license allows forks if needed).wkhtmltopdf memory limits or switch to async.wkhtmltopdf --debug-javascript for JS errors.| Issue Type | Support Level | Escalation Path |
|---|---|---|
| Twig template issues | High | Frontend team + QA |
| wkhtmltopdf crashes | Medium | DevOps (Docker/OS config) |
| Dompdf fallback | Low | TPM (feature request) |
wkhtmltopdf memory limits (e.g., --memory-limit 2G).| Failure Scenario | Impact | Mitigation Strategy |
|---|---|---|
| wkhtmltopdf crashes | No PDFs generated | Fallback to Dompdf + alerts (e.g., Sentry) |
| Template rendering errors | Corrupted PDFs | Pre-flight Twig template validation |
| Queue worker failures | Backlog of pending PDFs | Dead-letter queues + retries |
| High memory usage | Worker OOM kills | Resource limits + async processing |
| Font licensing issues | Missing characters in PDF | Embed fonts or use system-wide fonts |
How can I help you explore Laravel packages today?