getFilename(), '.pdf.twig') !== false; } public function render(InvoiceDocument $document, InvoiceModel $model): Response { $filename = new InvoiceFilename($model); $context = new PdfContext(); $context->setOption('filename', $filename->getFilename()); $context->setOption('setAutoTopMargin', 'pad'); $context->setOption('setAutoBottomMargin', 'pad'); $context->setOption('margin_top', '12'); $context->setOption('margin_bottom', '8'); $content = $this->renderTwigTemplate($document, $model, ['pdfContext' => $context]); $content = $this->converter->convertToPdf($content, array_merge($model->getOptions(), $context->getOptions())); return $this->createPdfResponse($content, $context); } }