Output example

$size = $pdf->getTemplateSize($template);
                if (!\is_array($size)) {
                    continue;
                }
                $pdf->AddPage('P', [$size['width']$size['height']]);
                $pdf->useTemplate($template);
            }
        }

        $hash = Random::getAlphanumericString(32);

        $pdf->Output($hash . '.pdf', 'D');

        $this->Response()->headers->set('content-type', 'application/x-download');
    }

    /** * Internal helper function which checks if the batch process needs a document creation. */
    private function createOrderDocuments(int $documentTypeId, int $documentMode, Order $order): void
    {
        if ($documentTypeId === 0) {
            return;
        }
'margin_right' => $this->_document['right'],
                    'margin_top' => $this->_document['top'],
                    'margin_bottom' => $this->_document['bottom'],
                ]
            );
            if ($this->_preview == true || !$this->_documentHash) {
                $mpdf = new Mpdf($mpdfConfig);
                $mpdf->setLogger(
                    Shopware()->Container()->get('corelogger')
                );
                $mpdf->WriteHTML($html);
                $mpdf->Output();
                exit;
            }

            $tmpFile = tempnam(sys_get_temp_dir(), 'document');
            $mpdf = new Mpdf($mpdfConfig);
            $mpdf->setLogger(
                Shopware()->Container()->get('corelogger')
            );
            $mpdf->WriteHTML($html);
            $mpdf->Output($tmpFile, 'F');

            
$this->fpdi->AddPage($config->getPageOrientation() ?? 'portrait', $config->getPageSize());
                $this->fpdi->useTemplate($template);
            }
        }

        if ($totalPage === 0) {
            return null;
        }

        $renderedDocument = new RenderedDocument('', '', $fileName);

        $renderedDocument->setContent($this->fpdi->Output($fileName, 'S'));
        $renderedDocument->setContentType(PdfRenderer::FILE_CONTENT_TYPE);
        $renderedDocument->setName($fileName);

        return $renderedDocument;
    }

    private function ensureDocumentMediaFileGenerated(DocumentEntity $document, Context $context): ?string
    {
        $documentMediaId = $document->getDocumentMediaFileId();

        if ($documentMediaId !== null || $document->isStatic()) {
            
'sepaHeaderText' => Shopware()->Config()->get('sepaHeaderText'),
            'sepaSellerId' => Shopware()->Config()->get('sepaSellerId'),
        ]);

        Shopware()->Template()->addTemplateDir(__DIR__ . '/../Views/');
        $data = Shopware()->Template()->fetch('frontend/plugins/sepa/email.tpl');

        /** @var array<string, string> $mpdfConfig */
        $mpdfConfig = Shopware()->Container()->getParameter('shopware.mpdf.defaultConfig');
        $mpdf = new Mpdf($mpdfConfig);
        $mpdf->WriteHTML($data);
        $pdfFileContent = $mpdf->Output('', 'S');

        if ($pdfFileContent === false) {
            throw new Enlight_Exception('Could not generate SEPA attachment file');
        }

        $attachmentName = 'SEPA_' . $orderNumber;

        $mail->createAttachment(
            $pdfFileContent,
            'application/pdf',
            Zend_Mime::DISPOSITION_ATTACHMENT,
            
Home | Imprint | This part of the site doesn't use cookies.