Topic: Update in reporting code

Hello,

Just wondering, when I am modifying report/creating new report, the current library is really uncomfortable to me. Is there any plan to update the library? Maybe using newer version of TCPDF and FPDI because it seems the current FA used is old version. Maybe also using DOMPDF to make report easier with HTML. I believe TCPDF also has capabilities to generate PDF from HTML though. Also for excel, PHPSpreadsheet is an awesome library instead of current Workbook.php used in FA. Any opinion? I am willing to help the development if needed. I have implemented my own reporting library using DOMPDF 5 years ago and it worked amazing.

Re: Update in reporting code

To avoid code bloat the various libraries are not being used. Also "old" does not mean "bad" and "new" does not have to mean "good". Users are free to extend the existing classes to suit their needs and submit it for peer review. Native rendering of TCPDF / FPDI makes for smaller PDF files rather than HTML to PDF conversions. Make a separate extension of your library using DOMPDF and the community will be the richer. Make for a simple meta template for reports and have any plugin library render the reports.

Re: Update in reporting code

So, I just updated the reporting with latest version of FPDI and TCPDF version 6. I put the updated repo in: https://github.com/barbarian1803/FA_new_reporting

I haven't checked all functionality but it seems to work just fine. With latest TCPDF version implemented, maybe there are new features in TCPDF that can be implemented and certainly, we can use HTML for designing the report because TCPDF has supported HTML. Please try it if anyone interested and kindly comment/report any problem or bug. Thank you.

Re: Update in reporting code

Nice work @barbarian. How does the code size compare?

Can anyone explain what the reporting/forms folder is for? We need to update the wiki on this score.

Re: Update in reporting code

The source code size is pretty much small. TCPDF is large because it includes font. In my repo, the font files have been removed so it is small now.

Form folder is used to put custom header.

In pdf_report.inc

function NewPage() 
    {
        if ($this->pageNumber==0)
        {
            // check if there is pdf header template for this report
            // and set if it is found
            $tmpl_pdf = find_custom_file("/reporting/forms/".$this->headerTmpl.".pdf");
            if ($tmpl_pdf) {
                $this->tmplSize = $this->setSourceFile($tmpl_pdf);
            }
        }

        $this->pageNumber++;
        parent::newPage();

        if ($this->tmplSize) {
            $this->row = $this->pageHeight - $this->topMargin; // reset row
            $id = $this->importPage(min($this->pageNumber, $this->tmplSize));
            $this->useTemplate($id);
        }

        // include related php file if any
        $tmpl_php = find_custom_file("/reporting/forms/".$this->headerTmpl.".php");
        if ($tmpl_php) {
            include($tmpl_php);
        }

        if (method_exists($this, $this->headerTmpl))    // draw predefined page layout if any
            $this->{$this->headerTmpl}();
    }

Re: Update in reporting code

@barbarian, great work. I will test it. I really needed a good reporting from HTML to PDF.

www.boxygen.pk