CodeIgniter Forums
Write PDF - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Write PDF (/showthread.php?tid=38446)

Write PDF - El Forum - 02-08-2011

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:
function index()

      $this->mpdf->WriteHTML('Hallo World');
      write_file('./file.pdf', $file)


Write PDF - El Forum - 02-08-2011

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.