CodeIgniter Forums
pdf export with unicode using mpdf - 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: pdf export with unicode using mpdf (/showthread.php?tid=59533)

Pages: 1 2


pdf export with unicode using mpdf - El Forum - 10-17-2013

[eluser]Bigil Michael[/eluser]
I have completed pdf export with malayalam font (indian) statically, using mpdf. When I read contents from database only square boxes are printing. Can any one help me ??

Code given below

Code:
$data['description'] = 'ആ സമയത്താണ് തമിഴിലെ സൂപ്പര്‍ ഹിറ്റ് ' ;
  $html = $this->load->view("admin/authors/test",$data,TRUE);
  $this->load->library('mpdf57/mpdf');
  $this->mpdf=new mPDF('utf-8','A4','','',32,25,27,25,16,13);
  $this->mpdf->WriteHTML($html,2);
  $this->mpdf->Output('mpdf.pdf','I');
It runs successfully

Code:
$row =   $this->Authors_model->get_selected($selected_authors);
  $data['description'] = entities_to_ascii($row->description);  
  $html = $this->load->view("admin/authors/test",$data,TRUE);  
  $this->load->library('mpdf57/mpdf');
  $this->mpdf=new mPDF('utf-8','A4','','',32,25,27,25,16,13);
  $this->mpdf->WriteHTML($html,2);
  $this->mpdf->Output('mpdf.pdf','I');
It prints square boxes


database like this
Code:
മല

Can any one help me to solve this issue......



pdf export with unicode using mpdf - El Forum - 10-19-2013

[eluser]Bigil Michael[/eluser]
bump....


pdf export with unicode using mpdf - El Forum - 10-21-2013

[eluser]Bigil Michael[/eluser]
any help............


pdf export with unicode using mpdf - El Forum - 10-22-2013

[eluser]Tpojka[/eluser]
Code:
ascii_to_entities()
from text helper can't do that?


pdf export with unicode using mpdf - El Forum - 10-22-2013

[eluser]Bigil Michael[/eluser]
already tried this but the result is same.


pdf export with unicode using mpdf - El Forum - 10-22-2013

[eluser]Otemu[/eluser]
Hi,

If you can render "font (indian) statically, using mpdf" is the data exactly the same when you tried statically as it is stored in the database??


pdf export with unicode using mpdf - El Forum - 10-22-2013

[eluser]Bigil Michael[/eluser]
when i echo the contents both are same. but when i check using page source it shows difference,
extra contents are updated like this

Code:
<p align="JUSTIFY"><span  karthika; font-size: medium;">ഇത് ഒരു ടെസ്റ്റ്&zwnj; വർക്ക്&zwnj; &nbsp;ആണ്&nbsp;</span></p>



pdf export with unicode using mpdf - El Forum - 10-22-2013

[eluser]Otemu[/eluser]
Try

Code:
$row =   $this->Authors_model->get_selected($selected_authors);
  $data['description'] = $row->description;

or try
Code:
$row =   $this->Authors_model->get_selected($selected_authors);
  $data['description'] = html_entity_decode($row->description);

instead of

Code:
$row =   $this->Authors_model->get_selected($selected_authors);
  $data['description'] = entities_to_ascii($row->description);



pdf export with unicode using mpdf - El Forum - 10-22-2013

[eluser]Bigil Michael[/eluser]
I tried these 3. first and last shows the result as blocks
second one shows error like this

Code:
HTML contains invalid UTF-8 character(s)

Research Pdf

ഇത് ഒരു ടെസ്റ്റ്‌ വർക്ക്‌ [[#160]]ആണ്[[#160]]

mPDF error:



pdf export with unicode using mpdf - El Forum - 10-22-2013

[eluser]Otemu[/eluser]
Am not sure, upload the code including db backup and I take a look for you