KoolReport's Forum

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

ExportPdf Pdf.view.php Not Being Used #1152

Closed Jason opened this topic on on Nov 13, 2019 - 3 comments

Jason commented on Nov 13, 2019

Your documentation says that on export of pdf, the file <filename>Pdf.view.php is being used to render the PDF file. However, your examples use the <filename>.view.php file, and if i point directly to the Pdf.view.php file, i get errors on Table objects not found, etc.

I am trying to remove a common header file used for navigation in the report module when the user wants to export the report.

Please advise.

KoolReport commented on Nov 14, 2019

Hi,

There is no rule that exporting needs to use the view name in <filename>Pdf.view.php. The general form of view file is <AnyName>.view.php and then you can render:

$report->run()->export("<AnyName>")->..

if you dont provide <AnyName> in the export() function, we understand the <AnyName> is the report class name. For example the $report class name is MyReport, we will look for MyReport.view.php file.

Jason commented on Nov 14, 2019

Then why do you explicitly state in your Description on the ExportPdf module "As you may notice the export using another view called SakilaRentalPdf.view.php to generate PDF. We separate the pdf-generated view with the for-browser view to be easier to manage. The view for PDF can have extra settings to control pdf margin or pdf header and footer."?

I want my export file to be a little bit different than the rendered report for the user in the browser, and my impression is thats why you have the Pdf.view.php file, but does not work if i reference that file vs the <filename>.view.php.

So how do i create a export file that is different than the file used to render the report for the browser to view?

Jason commented on Nov 14, 2019

It appears i was overlooking the fact i was missing the parameter in the export function for the Pdf view.

$report->export('MyReportPdf')->pdf()->toBrowser("MyReport.pdf");

Issue is resolved. Thank you!

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
solved

Export