I am having Problem in saving pdf generated by mPDF to a specific folder. Every thing is working fine with pdf generation, Only I am not able to save it to a local folder. Can any one help me out with that?
Short answer is to put the full path where you plan to save the file. Like so...
$mpdf->WriteHTML($html);
$mpdf->Output('/etc/home/JohnWayne/example/pdf/','F');
I found the solution. This is very simple. As for as mPDF library is concerned, it does not parse the base_url(). Instead we have to work with $_SERVER['DOCUMENT_ROOT']; In my case i have done as; Open the config.php in Application/config folder and insert the following;
$config['file_path']=$_SERVER['DOCUMENT_ROOT']."my_project/file/";
Now it is a peace of cake to call the config; Here is I have done in the controller;
$this->mpdf->Output($this->config->item('file_path')."invoice/arif.pdf",'F');
The Problem is solved. Do let me know if there is any technical or logical issue with my code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With