KoolReport's Forum

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

Export package show blank report #2428

Open saiful opened this topic on on Nov 12, 2021 - 40 comments

saiful commented on Nov 12, 2021

hi, im trying to create exportable report using export package in laravel, but my exported report show nothing, only a blank document. am i wrong if i write export script in my controller? this is my export controller:

$report             = new SUMMARY();
            $report->export()
            // ->settings([
            //     "useLocalTempFolder" => true,
            // ])
            ->pdf(array(
                "format"=>"A4",
                "orientation"=>"portrait",
                //"zoom"=>2
            ))
            ->toBrowser("SUMMARY_REPORT.pdf");

and this is the result:

Sebastian Morales commented on Nov 12, 2021

You must have a pdf view file named like "MyReportPDF.view.php" and your export command is then:

            $report = new SUMMARY();
            $report->run(); // report must be run for its data to be processed before rendering or exporting

            $report->export("MyReportPDF") // use the pdf view name excluding .view.php part
            // ->settings([
            //     "useLocalTempFolder" => true,
            // ])
            ->pdf(array(
                "format"=>"A4",
                "orientation"=>"portrait",
                //"zoom"=>2
            ))
            ->toBrowser("SUMMARY_REPORT.pdf"); 
saiful commented on Nov 12, 2021

still getting same error. when i tried to render, it display the report perfectly, but when i try to export then it just download a blank pdf.

is it correct? : - the "MyReportPdf" view located in App\Reports\, together with another report .view.php - calling export component in laravel controller - phantomJS located in /vendor/koolreport/export/bin/phantomjs.exe

Sebastian Morales commented on Nov 12, 2021

Yes, MyReportPdf.view.php should be in the same directory with MyReport.php and MyReport.view.php, to test it initially just put a "Hello world" string in your pdf view file. Pls make sure the filename and your export name (in ->export(...)) is case sensitive correctly. Another point is making sure your system temporary directory (or local directory if you use "useLocalTempFolder" => true) is writable for your php user.

saiful commented on Nov 12, 2021

i guess my script is correct,but the result still blank pdf

Sebastian Morales commented on Nov 12, 2021

Yes, your pdf view name looks correct. Pls replace all of its content with a simple string like "Hello world" and use a local temp dir as well:

...
            ->settings([
                "useLocalTempFolder" => true,
            ])
...
saiful commented on Nov 12, 2021

still get blank result

Sebastian Morales commented on Nov 12, 2021

Pls check for a local "tmp" directory at your report's path. Find the latest .tmp file there and open it with a text editor and let us know the result. Tks,

saiful commented on Nov 15, 2021

this is the result

Sebastian Morales commented on Nov 15, 2021

I need to know the content of the latest .tmp file (a text file). Rgds,

saiful commented on Nov 15, 2021

this is the content of latest tmp file

Sebastian Morales commented on Nov 15, 2021

The content looks correct. Would you pls follow these standard examples of phantomjs and let us know if screen capture works:

https://phantomjs.org/screen-capture.html

saiful commented on Nov 16, 2021

yesterday i tried export packages from koolreport pro examples, and here is the result

is it possibly the error come from phantomjs?

Sebastian Morales commented on Nov 16, 2021

Did you try the screen capture tests:

https://phantomjs.org/screen-capture.html

saiful commented on Nov 16, 2021

i get little confused with the screen capture test. this is the result

Sebastian Morales commented on Nov 16, 2021

Oh, don't enter phantomjs interactive mode. Just use command prompt to navigate to your phantomjs path, says koolreport/export/bin/phantomjs, and execute "phantomjs github.js".

saiful commented on Nov 16, 2021

i see, here is the result

Sebastian Morales commented on Nov 16, 2021

Pls open the file koolreport/export/Handler.php and replace this line:

$result = shell_exec($command);

with these ones:

echo "command = $command<br>"; exit;
// $result = shell_exec($command); 

Then try export and see the output command. Copy it to your command prompt (cmd, not powershell) to run it and let us know the result or error if there is. Tks,

saiful commented on Nov 16, 2021

here is the result

Sebastian Morales commented on Nov 16, 2021

Pls let us know the following:

  1. How did you install Phantomjs?
  2. What is your Phantomjs version? (you can find out by running phantomjs --version)
  3. Does this file exist: koolreport/export/pdf/embeded.js?
saiful commented on Nov 16, 2021

  1. i just follow tutorial from koolreport documentation, download execution file & copy to /koolreport/export/bin.

  2. phantomjs version: 2.1.1.

  3. yes, the file exist

Sebastian Morales commented on Nov 16, 2021

Pls open the file koolreport/export/Handler.php and replace this line:

    $params["resourceWaiting"] = $this->resourceWaiting;

with these ones:

    $params["resourceWaiting"] = $this->resourceWaiting;
    echo "export params = "; print_r($params); echo "<br>";

Then click export button and let us know the value of export params variable. Tks,

saiful commented on Nov 16, 2021

here is the result

Sebastian Morales commented on Nov 16, 2021

Oh, are you using PHP built-in web server or a full-fledged one like Apache, Nginx, etc?

Sebastian Morales commented on Nov 16, 2021

If it's possible pls run your project's report export using Apache, Nginx instead of PHP built-in server (via Laravel command, etc). The Phantomjs headless browser in Export package doesn't work well with PHP web server. Tks,

saiful commented on Nov 17, 2021

i use IIS on Windows server for local testing & Apache on ubuntu server for live

Sebastian Morales commented on Nov 17, 2021

Pls open the file koolreport/export/pdf/pdf.js and replace this line:

    page.setContent(expectedContent, expectedLocation);

with these ones:

    console.log('expectedLocation = ', expectedLocation);
    console.log('expectedContent = ', expectedContent);

    page.setContent(expectedContent, expectedLocation);

Still use these lines in Handler.php:

echo "command = $command<br>"; exit;
// $result = shell_exec($command); 

Then click export to get the phantomjs command. Copy and run it in command line and let us know the full output (you could copy the output as text). Tks,

saiful commented on Nov 17, 2021

here is the result:

Sebastian Morales commented on Nov 17, 2021

Pls post the FULL output. Tks,

saiful commented on Nov 17, 2021

i rename project path to XXXXXXXX because of company rules. here is the full output:

Microsoft Windows [Version 10.0.17763.107]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\saiful>D:\XXXXXXXX\vendor\koolreport\export/bin/phantomjs.exe --ignore-ssl-errors=true D:\XXXXXXXX\vendor\koolreport\export/pdf/pdf.js D:\XXXXXXXX\public/tmp/61948683bf24b2.tmp D:\XXXXXXXX\public/tmp/61948683c8e473.pdf eyJmb3JtYXQiOiJBNCIsIm9yaWVudGF0aW9uIjoicG9ydHJhaXQiLCJleHBlY3RlZExvY2F0aW9uIjoiaHR0cDpcL1wvMTI3LjAuMC4xOjg4ODBcL2V4cG9ydHBkZiIsInJlc291cmNlV2FpdGluZyI6MTAwMH0=
expectedLocation =  http://127.0.0.1:8880/exportpdf
expectedContent =  <html>
<head>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description" content="">
  <meta name="author" content="">

  <title>Shipment Summary</title>

  <!-- Custom fonts for this template-->
  <link   href='http://127.0.0.1:8880/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css'>
  <link   href='https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet'>
  <link  rel="stylesheet"  href='https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous'>

  <!-- Custom styles for this template
  <link   href='http://127.0.0.1:8880/css/sb-admin-2.min.css" rel="stylesheet'>-->

</head>

<body><style type='text/css'>@media print
{
    .page-break
    {
        display:block !important;
        width:0px !important;
        height:0px !important;
        page-break-before: always !important;
    }
    .no-break
    {
        page-break-inside: avoid;
    }
    body
    {
        zoom:1 !important;
    }
}</style><script type='text/javascript'>var pdf_export = {
    zoom:1,
    init:function()
    {
        var settings = {header:null,footer:null,margin:null};
        settings.margin = {
            top:document.body.style.marginTop?document.body.style.marginTop:"0px",
            left:document.body.style.marginLeft?document.body.style.marginLeft:"0px",
            right:document.body.style.marginRight?document.body.style.marginRight:"0px",
            bottom:document.body.style.marginBottom?document.body.style.marginBottom:"0px"
        };
        document.body.style.margin = "0px";
        var el = document.querySelector('div.page-header');
        if(el)
        {
            el.style.zoom = this.zoom;
            settings.header = {
                contents: el.outerHTML,
                height:el.style.height?el.style.height:'25px',
            };
            el.parentNode.removeChild(el);
        }
        var el = document.querySelector('div.page-footer');
        if(el)
        {
            el.style.zoom = this.zoom;
            settings.footer = {
                contents: el.outerHTML,
                height:el.style.height?el.style.height:'25px',
            };
            el.parentNode.removeChild(el);
        }
        return settings;
    }
}</script><script  type='text/javascript'  src='/koolreport_assets/3409401219/KoolReport.js'></script>
    <h4 style="color:navy"><b>Test Reporting</b></h4>
    <br>
        <krwidget widget-name='datatables61948683bb5361' widget-type='koolreport/datagrid/DataTables'><table id="datatables61948683bb5361" class='table table-striped table-sm table-hover table-bordered'>
...
Sebastian Morales commented on Nov 17, 2021

Do you still see the error "can't find variable pdf_export"? And is the rendered pdf still blank?

saiful commented on Nov 17, 2021

there's no error "can't find variable pdf_export", but this is the export result in tmp folder:

Sebastian Morales commented on Nov 17, 2021

I guess export would work now if you replaced these lines in Handler.php:

echo "command = $command<br>"; exit;
// $result = shell_exec($command);

with:

// echo "command = $command<br>"; exit;
$result = shell_exec($command);

One thing that might be missing is loading css files. If you used Laravel I would suggest using our Laravel companion package:

https://www.koolreport.com/docs/laravel/overview/#step-by-step-tutorial-step-1:-create-report-and-claim-friendship-with-laravel

It would create a kool_assets subdirectory in your Laravel's public dir and copy css, js files there instead of trying to access those in vendor dir.

saiful commented on Nov 17, 2021

yes, i already use koolreport laravel friendship and get koolreport_asset in public dir.

but when i replace the handler script and i click export, here is the result:

Sebastian Morales commented on Nov 17, 2021

Pls open the exported pdf file in a text editor (like Visual Studio Code, etc) to see if there's warning/notice/error message that causes its format issue?

saiful commented on Nov 17, 2021

there is no error found. here is the content:

Sebastian Morales commented on Nov 17, 2021

Oh, pls comment out this added line in Handler.php:

    echo "export params = "; print_r($params); echo "<br>"; // comment out this echo line
saiful commented on Nov 17, 2021

the result is blank again.

there's no any error inside pdf file

Sebastian Morales commented on Nov 17, 2021

So it seems executing the phantomjs command in PHP is different from executing in command line. Replace this line in koolreport/export/pdf/pdf.js:

    console.log("1;" + output);

with this one:

    console.log("1;" + expectedContent + ";" + output);

Replace this one in koolreport/export/Handler.php:

    $result = shell_exec($command);

with these ones:

    $result = shell_exec($command);
    echo str_replace("<", "&lt", $result); exit;

Then click export button and let us know full output. Tks,

saiful commented on Nov 17, 2021

here is the result:

expectedLocation = http://127.0.0.1:8880/exportpdf expectedContent = <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="description" content=""> <meta name="author" content=""> <title>Shipment Summary</title> <!-- Custom fonts for this template--> <link href='http://127.0.0.1:8880/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css'> <link href='https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet'> <link rel="stylesheet" href='https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous'> <!-- Custom styles for this template <link href='http://127.0.0.1:8880/css/sb-admin-2.min.css" rel="stylesheet'>--> </head> <body><style type='text/css'>@media print { .page-break { display:block !important; width:0px !important; height:0px !important; page-break-before: always !important; } .no-break { page-break-inside: avoid; } body { zoom:1 !important; } }</style><script type='text/javascript'>var pdf_export = { zoom:1, init:function() { var settings = {header:null,footer:null,margin:null}; settings.margin = { top:document.body.style.marginTop?document.body.style.marginTop:"0px", left:document.body.style.marginLeft?document.body.style.marginLeft:"0px", right:document.body.style.marginRight?document.body.style.marginRight:"0px", bottom:document.body.style.marginBottom?document.body.style.marginBottom:"0px" }; document.body.style.margin = "0px"; var el = document.querySelector('div.page-header'); if(el) { el.style.zoom = this.zoom; settings.header = { contents: el.outerHTML, height:el.style.height?el.style.height:'25px', }; el.parentNode.removeChild(el); } var el = document.querySelector('div.page-footer'); if(el) { el.style.zoom = this.zoom; settings.footer = { contents: el.outerHTML, height:el.style.height?el.style.height:'25px', }; el.parentNode.removeChild(el); } return settings; } }</script><script type='text/javascript' src='/koolreport_assets/3409401219/KoolReport.js'></script> <h4 style="color:navy"><b>Test Reporting</b></h4> <br> <krwidget widget-name='datatables6194ccf3c5ad41' widget-type='koolreport/datagrid/DataTables'><table id="datatables6194ccf3c5ad41" class='table table-striped table-sm table-hover table-bordered'> <thead> <tr> <th class='text-danger text-center'> Cst No </th> <th class='text-danger text-center'> Name </th> <th class='text-danger text-center'> Last Name </th> <th class='text-danger text-center'> First Name </th> <th class='text-danger text-center'> Phone </th> <th class='text-danger text-center'> Address </th> <th class='text-danger text-center'> City </th> <th class='text-danger text-center'> State </th> <th class='text-danger text-center'> Post Code </th> <th class='text-danger text-center'> Country </th> </tr> </thead> <tbody> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> </tbody> <tfoot> <tr> <td class='text-right'> </td> <td class='text-right'> </td> <td class='text-right'> </td> <td class='text-right'> </td> <td class='text-right'> </td> <td class='text-right'> </td> <td class='text-right'> </td> <td class='text-right'> </td> <td class='text-right'> </td> <td class='text-right'> </td> </tr> </tfoot> </table> <script type="text/javascript"> KoolReport.widget.init( {"js":["\/koolreport_assets\/1877068485\/jquery.min.js",["\/koolreport_assets\/4027917509\/KRDataTables.js","\/koolreport_assets\/4027917509\/datatables.min.js",["\/koolreport_assets\/4027917509\/pagination\/input.js","\/koolreport_assets\/4027917509\/datatables.bs4.min.js","\/koolreport_assets\/4027917509\/Buttons-1.6.2\/js\/dataTables.buttons.min.js","\/koolreport_assets\/4027917509\/Buttons-1.6.2\/js\/buttons.colVis.min.js","\/koolreport_assets\/4027917509\/Buttons-1.6.2\/js\/buttons.html5.min.js","\/koolreport_assets\/4027917509\/Buttons-1.6.2\/js\/buttons.print.min.js","\/koolreport_assets\/4027917509\/JSZip-2.5.0\/jszip.min.js","\/koolreport_assets\/4027917509\/pdfmake-0.1.36\/pdfmake.min.js",["\/koolreport_assets\/4027917509\/pdfmake-0.1.36\/vfs_fonts.js"],"\/koolreport_assets\/4027917509\/AutoFill-2.3.5\/js\/dataTables.autoFill.min.js","\/koolreport_assets\/4027917509\/ColReorder-1.5.2\/js\/dataTables.colReorder.min.js","\/koolreport_assets\/4027917509\/RowGroup-1.1.2\/js\/dataTables.rowGroup.min.js","\/koolreport_assets\/4027917509\/Select-1.3.1\/js\/dataTables.select.min.js"]]],"css":["\/koolreport_assets\/4027917509\/KRDataTables.css","\/koolreport_assets\/4027917509\/datatables.bs4.min.css"]}, function() { var name = 'datatables6194ccf3c5ad41'; var dtOptions = {"searching":false,"paging":false,"responsive":true,"columnDefs":[]}; var fastRender = 0; if (fastRender) { dtOptions.data = [{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"},{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"},{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"},{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"},{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"},{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"},{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"},{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"},{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"},{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"}]; } var dt = window[name] = $('#' + name).DataTable(dtOptions); var datatables6194ccf3c5ad41_data = { id: 'datatables6194ccf3c5ad41', searchOnEnter: 0, searchMode: 'default', serverSide: 0, rowDetailData: dtOptions.rowDetailData, showColumnKeys: ["customerNumber","customerName","contactLastName","contactFirstName","phone","addressLine1","city","state","postalCode","country"], fastRender: fastRender, rowDetailIcon: 1, rowDetailSelector: '', }; KRdatatables6194ccf3c5ad41 = KoolReport.KRDataTables.create( datatables6194ccf3c5ad41_data); } ); </script></krwidget></body> </html> 1;<html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="description" content=""> <meta name="author" content=""> <title>Shipment Summary</title> <!-- Custom fonts for this template--> <link href='http://127.0.0.1:8880/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css'> <link href='https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet'> <link rel="stylesheet" href='https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous'> <!-- Custom styles for this template <link href='http://127.0.0.1:8880/css/sb-admin-2.min.css" rel="stylesheet'>--> </head> <body><style type='text/css'>@media print { .page-break { display:block !important; width:0px !important; height:0px !important; page-break-before: always !important; } .no-break { page-break-inside: avoid; } body { zoom:1 !important; } }</style><script type='text/javascript'>var pdf_export = { zoom:1, init:function() { var settings = {header:null,footer:null,margin:null}; settings.margin = { top:document.body.style.marginTop?document.body.style.marginTop:"0px", left:document.body.style.marginLeft?document.body.style.marginLeft:"0px", right:document.body.style.marginRight?document.body.style.marginRight:"0px", bottom:document.body.style.marginBottom?document.body.style.marginBottom:"0px" }; document.body.style.margin = "0px"; var el = document.querySelector('div.page-header'); if(el) { el.style.zoom = this.zoom; settings.header = { contents: el.outerHTML, height:el.style.height?el.style.height:'25px', }; el.parentNode.removeChild(el); } var el = document.querySelector('div.page-footer'); if(el) { el.style.zoom = this.zoom; settings.footer = { contents: el.outerHTML, height:el.style.height?el.style.height:'25px', }; el.parentNode.removeChild(el); } return settings; } }</script><script type='text/javascript' src='/koolreport_assets/3409401219/KoolReport.js'></script> <h4 style="color:navy"><b>Test Reporting</b></h4> <br> <krwidget widget-name='datatables6194ccf3c5ad41' widget-type='koolreport/datagrid/DataTables'><table id="datatables6194ccf3c5ad41" class='table table-striped table-sm table-hover table-bordered'> <thead> <tr> <th class='text-danger text-center'> Cst No </th> <th class='text-danger text-center'> Name </th> <th class='text-danger text-center'> Last Name </th> <th class='text-danger text-center'> First Name </th> <th class='text-danger text-center'> Phone </th> <th class='text-danger text-center'> Address </th> <th class='text-danger text-center'> City </th> <th class='text-danger text-center'> State </th> <th class='text-danger text-center'> Post Code </th> <th class='text-danger text-center'> Country </th> </tr> </thead> <tbody> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> <tr class=''> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> <td class=''> - </td> </tr> </tbody> <tfoot> <tr> <td class='text-right'> </td> <td class='text-right'> </td> <td class='text-right'> </td> <td class='text-right'> </td> <td class='text-right'> </td> <td class='text-right'> </td> <td class='text-right'> </td> <td class='text-right'> </td> <td class='text-right'> </td> <td class='text-right'> </td> </tr> </tfoot> </table> <script type="text/javascript"> KoolReport.widget.init( {"js":["\/koolreport_assets\/1877068485\/jquery.min.js",["\/koolreport_assets\/4027917509\/KRDataTables.js","\/koolreport_assets\/4027917509\/datatables.min.js",["\/koolreport_assets\/4027917509\/pagination\/input.js","\/koolreport_assets\/4027917509\/datatables.bs4.min.js","\/koolreport_assets\/4027917509\/Buttons-1.6.2\/js\/dataTables.buttons.min.js","\/koolreport_assets\/4027917509\/Buttons-1.6.2\/js\/buttons.colVis.min.js","\/koolreport_assets\/4027917509\/Buttons-1.6.2\/js\/buttons.html5.min.js","\/koolreport_assets\/4027917509\/Buttons-1.6.2\/js\/buttons.print.min.js","\/koolreport_assets\/4027917509\/JSZip-2.5.0\/jszip.min.js","\/koolreport_assets\/4027917509\/pdfmake-0.1.36\/pdfmake.min.js",["\/koolreport_assets\/4027917509\/pdfmake-0.1.36\/vfs_fonts.js"],"\/koolreport_assets\/4027917509\/AutoFill-2.3.5\/js\/dataTables.autoFill.min.js","\/koolreport_assets\/4027917509\/ColReorder-1.5.2\/js\/dataTables.colReorder.min.js","\/koolreport_assets\/4027917509\/RowGroup-1.1.2\/js\/dataTables.rowGroup.min.js","\/koolreport_assets\/4027917509\/Select-1.3.1\/js\/dataTables.select.min.js"]]],"css":["\/koolreport_assets\/4027917509\/KRDataTables.css","\/koolreport_assets\/4027917509\/datatables.bs4.min.css"]}, function() { var name = 'datatables6194ccf3c5ad41'; var dtOptions = {"searching":false,"paging":false,"responsive":true,"columnDefs":[]}; var fastRender = 0; if (fastRender) { dtOptions.data = [{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"},{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"},{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"},{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"},{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"},{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"},{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"},{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"},{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"},{"customerNumber":"-","customerName":"-","contactLastName":"-","contactFirstName":"-","phone":"-","addressLine1":"-","city":"-","state":"-","postalCode":"-","country":"-"}]; } var dt = window[name] = $('#' + name).DataTable(dtOptions); var datatables6194ccf3c5ad41_data = { id: 'datatables6194ccf3c5ad41', searchOnEnter: 0, searchMode: 'default', serverSide: 0, rowDetailData: dtOptions.rowDetailData, showColumnKeys: ["customerNumber","customerName","contactLastName","contactFirstName","phone","addressLine1","city","state","postalCode","country"], fastRender: fastRender, rowDetailIcon: 1, rowDetailSelector: '', }; KRdatatables6194ccf3c5ad41 = KoolReport.KRDataTables.create( datatables6194ccf3c5ad41_data); } ); </script></krwidget></body> </html>;D:\XXXXXX\public/tmp/6194ccf3cdd253.pdf
Sebastian Morales commented on Nov 17, 2021

Replace your pdf view content with a simple string "Hello world", try export first with echo:

    echo str_replace("<", "&lt", $result); exit;

then without:

    // echo str_replace("<", "&lt", $result); exit;

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