Download html view in pdf |
[eluser]Zorancho[/eluser]
I have a form on one of my pages, once submitted, it puts stuff into database and according to what the user has inserted a different view has been generated. Now on the generated view i have to enable a link that will download the whole page as PDF, but with Cyrillic font (Serbian in my case). I was thinking about this solution: Before i generate the view i want to save it as pdf into a temporary folder and then on the view give link that will simply download the file to the user's machine. I was wondering if there is any other more simple solution than this? Notice i have to enable the download via link on the same page. Is DomPDF okay to use for the cyrillic support? Thanks in advance
[eluser]tomcode[/eluser]
As far as I know does DOMPDF not support UTF-8, which is probably (?) what You want. I recently used a TCPDF CI integration from the Wiki, which does have UTF-8 support. You will need to create Your font files, though, (the TCPDF comes with tools to do it).
[eluser]Zorancho[/eluser]
Thanks, i fixed it all except that i need cyrillic fonts, but is there any tutorial how to do it with TCPDF?
[eluser]tomcode[/eluser]
In theTCPDF distribution, in the fonts folder I believe, are all required utilities, scripts and a readme how to create the font files from a TrueType font.
[eluser]Zorancho[/eluser]
fixed it this way: $data['something'] = $this->Model->get_something(); $this->load->library('pdf'); //This is from the wiki the integration library. $this->pdf->SetSubject('Subject'); $this->pdf->AddPage(); $this->pdf->SetFont('freeserif', '', 12); //This font supports serbian latin. $html = $this->parser->parse('some_view', $data); //I have parser class loaded previously //I tried loading a view, but it didn't work. Also tcpdf hates characters like <br/> $this->pdf->writeHTML($html, true, 0, true, 0); $this->pdf->lastPage(); ob_end_clean(); //I had to use this, otherwise it produces error about the headers being sent already. $this->pdf->Output('File.pdf', 'I'); Hope someone finds it helpful. If you want more help, send me private message. Thanks again for the help and pointing out the TCPDF. |
Welcome Guest, Not a member yet? Register Sign In |