KoolReport's Forum

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

Export package questions #217

Open EGROW SOLUTIONS, LLC opened this topic on on Feb 15, 2018 - 2 comments

EGROW SOLUTIONS, LLC commented on Feb 15, 2018

Hello,

Using KoolReportPro Enterprise License 2.37.0

have the following in the file _testFileExport.php

<html>
    <body style="margin: 1in">
        <header style='height:40px'>
            <span>Header</span>
        </header>
        <p>
          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec commodo ut metus in varius. Nullam nec velit in tortor suscipit mattis. Nullam id consequat erat, nec blandit ante. Maecenas id dolor bibendum nisl rhoncus semper. Suspendisse posuere eu lacus nec pretium. Maecenas eget ultricies urna, a pretium ex. Fusce consectetur, nunc malesuada consequat ultrices, quam quam hendrerit risus, non maximus est ex in turpis. Sed hendrerit imperdiet nulla quis ornare. Proin ornare tristique urna sed egestas. Aliquam finibus non magna eget aliquam. Donec dictum purus a justo sagittis, sed eleifend arcu varius. Ut tempor eget sem nec egestas. Etiam efficitur cursus ipsum eget volutpat. In hac habitasse platea dictumst.
        </p>
   
        <footer style='height:40px'>
            <span>Footer Page {pageNum}/{numPages}</span>
        </footer>
    </body>
</html>

Then I have the following in _testExport.php

  require_once(EG_ABSPATH . "lib/koolreport/autoload.php");
  use \koolreport\instant\Exporter;

  Exporter::export("_testFileExport.php")
  ->pdf(array(
        "format"=>"A4"
        ,"orientation"=>"potrait"
  ))
  ->toBrowser("_testReportExport.pdf");

Questions:

  1. I am opening _testExport.php in iFrame - but instead of previweing in the browser, it downloads the pdf instead. how do I set it to preview.

  2. Page numbers are not working

Please advise,

Kris

EGROW SOLUTIONS, LLC commented on Feb 15, 2018

ok. I figured out why it was not previewing in browser . its because content-disposition is set to attachment - I changed to inline then it previewed in browser.

May you could add another parameter to toBrowser function

public function toBrowser($filename,$mode='attachment')
{
  .....
 header("Content-Disposition:" . $mode . " ; filename=\"$filename\"");
}
KoolReport commented on Feb 16, 2018

That's great.

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
None yet

None