KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Koolreports and batch mode/command line #1724

Open Datagaard opened this topic on on Nov 20, 2020 - 3 comments

Datagaard commented on Nov 20, 2020

Can Koolreports be run as a command line process, as a part of a batch process, where multiple reports can be created "in line" as other process's take place.?

For instance an Invoice Summary Register, where each invoice would be created and "printed/pdf'd" in sequence while iterating through a batch of invoices

David Winterburn commented on Nov 20, 2020

Hi,

It's certainly possible to do that. In your export.php page just remember to replace the method ->toBrowser($pdfFile) with ->saveAs($pathToExportedPdfFile) so the exported pdf files could be saved directly.

Datagaard commented on Nov 22, 2020

Thanks David for your prompt reply.

Are there any examples of how to run a KoolReport from the command line?

David Winterburn commented on Nov 23, 2020

Hi,

Says you have your report class file MyReport.php, a report pdf view file MyReportPdf.view.php, and an export file Export.php:

//MyReport.php
class MyReport extends koolreport\KoolReport
{
    ...
}

//Export.php
require "MyReport.php";

$report = new MyReport();
$report->run()->export("MyReportPdf")->saveAs("path/to/saved/export/MyReport.pdf");

Then to export and save your report pdf file it's a simple command in your command line/terminal

php path/to/Export.php

Let us know if you need any more details. Thanks!

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

Export