We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38666
    • 98 Posts
    Good morning Jako

    I've been polishing up the PDFresource report we have been working on and had a thought. This morning I needed to add a footer and page number. Although in some reports this could get quite resource intensive for me adding these as a HTMLFooter was the best option.

    Is there a way you could add a TV, similar to the PDF Options, that could insert other mPDF options into pdfresource/model/pdfresource/pdfresource.class.php around line 227 on a case by case basic rather than rewriting pdfresource.class.php.
      Give a man the answer, and he’ll only have a temporary solution. Teach him the principles that led you to that answer, and he will be able to create his own solutions in the future.
      • 13428 ☆ A M B ☆
      • 1,031 Posts
      Phew, have to think about how all (or at least the most) options could be set without enhancing the package for each mPDF option.
        • 38666
        • 98 Posts
        Thanks for considering...
        For now I crudely did it like this (pdfresoure.class circ line 227) which will give me a document specific setting.
        // Shep's Mods
                $pgtitle = $this->pdf->SetTitle($resource->get('pagetitle'));
                if ($pdfTpl == "Your_CEP_pdf_long_Tpl")
                {
                    $CSAAC_footer = '<div align= "right" style= "font-size: 8pt;">{PAGENO}</div><div align= "center" style= "font-size: 8pt; color: #000000; font-style: italic;"><hr>Please Review Your Report And Advise The CSAAC Office Of Any Changes Or Additions.<br> S\'il Vous Plaît Lire Votre Rapport Et Conseiller Le Bureau CSAAC De Tout Changement Ou Ajouts.</div>';
                $this->pdf->SetHTMLFooter($CSAAC_footer);
                }  

        I'm sure there is a much better way of hooking into the mPDf options, perhaps an 'include' to a config file with switches for various documents and a default back to the basic pdfresource setup.

        Jim
          Give a man the answer, and he’ll only have a temporary solution. Teach him the principles that led you to that answer, and he will be able to create his own solutions in the future.
          • 13428 ☆ A M B ☆
          • 1,031 Posts
          Maybe all pdfresource system settings/or resource based options starting with set… could call the according Set… method of the $this->pdf automatically if that method exist. I will look through the mPDF method names if it is possible.
            • 38666
            • 98 Posts
            Thanks, I for one would be very interested.

            Jim
              Give a man the answer, and he’ll only have a temporary solution. Teach him the principles that led you to that answer, and he will be able to create his own solutions in the future.
              • 13428 ☆ A M B ☆
              • 1,031 Posts
              Version 1.5.0 is available: Set all mPDF options by calling mPDF class methods with callbacks.
                • 38666
                • 98 Posts
                Thanks for all your efforts - a great extra.

                  Give a man the answer, and he’ll only have a temporary solution. Teach him the principles that led you to that answer, and he will be able to create his own solutions in the future.