I need to compose a pdf using pdflib version 8, In which I need to print certain unicode characters
But they are not getting rendered ,Instead below characters are displaying
What could be the reason & How can I render the characters?
Below is the code
$p = PDF_new();
/* open new PDF file; insert a file name to create the PDF on disk */
if (PDF_begin_document($p, "", "") == 0) {
die("Error: " . PDF_get_errmsg($p));
}
PDF_set_info($p, "Creator", "Abc");
PDF_set_info($p, "Author", "Abc");
PDF_set_info($p, "Title", "Test");
pdf_set_option($p, "textformat=utf8");
PDF_begin_page_ext($p, 595, 842, "");
$fontdir = '/usr/share/fonts/truetype/dejavu';
pdf_set_parameter($p, "FontOutline", "Dejavu=$fontdir/DejaVuSans.ttf");
$font = pdf_load_font($p, "Dejavu", "unicode","");
PDF_setfont($p, $font, 24.0);
PDF_set_text_pos($p, 50, 700);
pdf_show_xy($p,"dejb €",100,490);
pdf_show_xy($p,"dejb ",200,490);
PDF_end_page_ext($p, "");
PDF_end_document($p, "");
$buf = PDF_get_buffer($p);
$len = strlen($buf);
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=hello.pdf");
print $buf;
PDF_delete($p);
Output
Edit:
Tried using freesans font instead of dejavu, but no change in the output.
$fontdir = '/usr/share/fonts/truetype/freefont';
pdf_set_parameter($p, "FontOutline", "FreeSans=$fontdir/FreeSans.ttf");
$font = pdf_load_font($p, "FreeSans", "unicode","")