public function createOrderPdfDynamically(
        ApiOrderInterface $apiOrder,
        $templateHeaderPath = null,
        $templateBasePath = null,
        $templateMainPath = null,
        $templateFooterPath = null
    ) {
        $data = $this->getContentForPdf($apiOrder);

        if ($templateHeaderPath === null) {
            $templateHeaderPath = $this->templateHeaderPath;
        }

        $header = $this->pdfManager->renderTemplate(
            $templateHeaderPath,
            []
        );

        if ($templateFooterPath === null) {
            $templateFooterPath = $this->templateFooterPath;
        }

        $footer = $this->pdfManager->renderTemplate(
            $templateFooterPath,
            []
        );

        if ($templateBasePath === null) {
            $templateBasePath = $this->templateConfirmationPath;
        }
        // Change the base template which will be extended to the confirmation template.
        $data['templateDynamicBasePath'] = $templateBasePath;

        if ($templateMainPath === null) {
            $templateMainPath = $this->templateDynamicPath;
        }

        $pdf = $this->pdfManager->convertToPdf(
            $templateMainPath,
            $data,
            false,
            [
                'footer-html' => $footer,
                'header-html' => $header
            ]
        );

        return $pdf;
    }
public function createOrderPdfDynamically(
        ApiOrderInterface $apiOrder,
        $templateHeaderPath = null,
        $templateBasePath = null,
        $templateMainPath = null,
        $templateFooterPath = null
    ) {
        $data = $this->getContentForPdf($apiOrder);

        if ($templateHeaderPath === null) {
            $templateHeaderPath = $this->templateHeaderPath;
        }

        $header = $this->pdfManager->renderTemplate(
            $templateHeaderPath,
            []
        );

        if ($templateFooterPath === null) {
            $templateFooterPath = $this->templateFooterPath;
        }

        $footer = $this->pdfManager->renderTemplate(
            $templateFooterPath,
            []
        );

        if ($templateBasePath === null) {
            $templateBasePath = $this->templateConfirmationPath;
        }
        // Change the base template which will be extended to the confirmation template.
        $data['templateDynamicBasePath'] = $templateBasePath;

        if ($templateMainPath === null) {
            $templateMainPath = $this->templateDynamicPath;
        }

        $pdf = $this->pdfManager->convertToPdf(
            $templateMainPath,
            $data,
            false,
            [
                'footer-html' => $footer,
                'header-html' => $header
            ]
        );

        return $pdf;
    }
public function createOrderPdfDynamically ( ApiOrderInterface $ apiOrder , $ templateHeaderPath = null , $ templateBasePath = null , $ templateMainPath = null , $ templateFooterPath = null ) { $ data = $ this -> getContentForPdf ( $ apiOrder ) ; if ( $ templateHeaderPath === null ) { $ templateHeaderPath = $ this -> templateHeaderPath ; } $ header = $ this -> pdfManager -> renderTemplate ( $ templateHeaderPath , [ ] ) ; if ( $ templateFooterPath === null ) { $ templateFooterPath = $ this -> templateFooterPath ; } $ footer = $ this -> pdfManager -> renderTemplate ( $ templateFooterPath , [ ] ) ; if ( $ templateBasePath === null ) { $ templateBasePath = $ this -> templateConfirmationPath ; } // Change the base template which will be extended to the confirmation template. $ data [ 'templateDynamicBasePath' ] = $ templateBasePath ; if ( $ templateMainPath === null ) { $ templateMainPath = $ this -> templateDynamicPath ; } $ pdf = $ this -> pdfManager -> convertToPdf ( $ templateMainPath , $ data , false , [ 'footer-html' => $ footer , 'header-html' => $ header ] ) ; return $ pdf ; }
Function to create a pdf for a given order using given templates.

@param ApiOrderInterface $apiOrder
@param string $templateHeaderPath
@param string $templateBasePath
@param string $templateMainPath
@param string $templateFooterPath

@return File
Function to create a pdf for a given order using given templates .