Display session variable in PDF template

juergen_mueller

DaDaBIK Guru
Hi Eugenio

I want to add a user's user_name into a PDF template, either in the header_template or in the public function HEADER of the related php file

Is there way to add a session variable like $_SESSION['logged_user_infos_ar']["username_user"], particularly for a grid view?

Thanks,

Juergen
 

eugenio

Administrator
Staff member
Hello,
you should be able to use it in the public function Header you might have in your MYPDF class (which extends TCPDF) in the templatename.php file, just write your code there and when you need to display something use the writeHTML method of the class.

I haven't tested it but this should work:

$this->writeHTML('The current user is: '. $_SESSION['logged_user_infos_ar']["username_user"]);

Best,
 
Top