Welcome Guest, Not a member yet? Register   Sign In
Write PDF
#1

[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)

    }
#2

[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
#3

[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-w...niter.html




Theme © iAndrew 2016 - Forum software by © MyBB