CodeIgniter Forums
Write PDF - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Write PDF (/showthread.php?tid=38446)



Write PDF - El Forum - 02-08-2011

[eluser]penta997[/eluser]
Hi.I'm using Mpdf library and I want to save pdf, witch I've generated, into my hard disc. But path is incorrect. I can only save file on the server. Is there possibillity to choose destination of saves files?
This is my code:
Code:
function index()
    {

      $this->load->library('mpdf');
      $this->mpdf->WriteHTML('Hallo World');
      $this->load->helper('file');
      $file=$this->mpdf->Output('test.pdf','F');
      write_file('./file.pdf', $file)

    }



Write PDF - El Forum - 02-08-2011

[eluser]tomcode[/eluser]
You have to send the PDF to the client (download). I don't know mpdf, but it looks like the second parameter triggers that, look up the it's documentation


Write PDF - El Forum - 05-14-2012

[eluser]Tudip Technologies[/eluser]
If you do not specify the path in that output method call, it would ask user to save it.
I don't think you can force download at specific location on client machine anyway.
We have been using mpdf 5.+ version and it works pretty much out of the box with CI.

In case you have problem with the mpdf+CI, here is a small blog entry.

http://tudip.blogspot.com/2012/05/mpdf-with-codeigniter.html