KoolReport's Forum

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

Export package file naming #203

Open EGROW SOLUTIONS, LLC opened this topic on on Jan 26, 2018 - 2 comments

EGROW SOLUTIONS, LLC commented on Jan 26, 2018

Hello,

Seems like its important to use .view when naming file.

could you please add an option to pass what ever the file name is for example ->export("myfilename.php") or ->export("myfilename.html") or let us know how to do this

Any help appreciated.

Thanks,

KoolReport Pro Customer

KoolReport commented on Jan 27, 2018

Hi,

I have write a simple solution for you here:

First, create a Exporter.php with following content:

<?php
require_once "../../../koolreport/autoload.php"; // Please change path according to your folder structure
class Exporter extends \koolreport\KoolReport
{
    use \koolreport\export\Exportable;
}

function export($file,$name)
{
    $exporter = new Exporter(array("file"=>$file));
    $exporter->export()
    ->pdf(array(
        "format"=>"A4",
        "orientation"=>"portrait"
    ))
    ->toBrowser($name);
}

Now create its view Exporter.view.php with following content

<?php include $this->params["file"];?>

All done!

Now how to use above code to generate content of any php or html file:

<?php
require_once "Exporter.php";

export("/path/to/mycontent.html","content.pdf");

Just simple as that, the first parameter is the path to your php/html file with any name. The second parameter is the name of pdf file.

If it confuses you, then email us to support@koolreport.com, I will send you all files.

Hope that helps

KoolReport commented on Jan 27, 2018

New solution:

Please download the KoolReport Pro 2.32.7. This version contains Instant package 2.0.0 which is able to help you to export any file:

require_once "../koolreport/autoload.php";
use \koolreport\instant\Exporter;

Exporter::export("/full/path/to/your/file.php")
->pdf(array(
    "format"=>"A4",
    "orientation"=>"portrait"
))
->toBrowser("myfile.pdf");

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
wiki
help needed

None