Page 1 of 1

Customised PDF report File Name

Posted: Tue Jan 18, 2022 12:45 am
by nc07
Hello Everyone,

Current PDF when downloaded had to be renamed manually, this can be done automatically based on the description set in your reports and titles without sending additional data from the form via javascript.
Below is the code that is required in nurunpdf.php. This can be changed to one's preference or the original configuration could be left as it is.

Just thought of sharing with everyone.

Code: Select all

$desc = $JSON->description;
$title = $JSON->title;
$date = date('Y-m-d_H-i-s');
$file_name = 'Report_' . $title . '_' . $desc . '-' . $date . '.pdf';

//$PDF->Output('nureport.pdf', 'I');
$PDF->Output($file_name, 'I');

Re: Customised PDF report File Name

Posted: Tue Jan 18, 2022 8:06 am
by kev1n
Thank you for your suggestion. I even think of going one step further so that you can specify any file name (something like this)
I will get back to you as soon as I have something worked out.