I want to get a pdf with Russina text. VS2010 use libharu
My source code file is encoded as Cyrillic(ISO) Use this code to set font and encoding
detail_font = HPDF_GetFont(pdf, "Times-Roman", "ISO8859-5");
The full code :
int main (int argc, char **argv)
{
HPDF_Doc pdf;
char fname[256];
HPDF_Page page;
HPDF_Font title_font;
HPDF_Font detail_font;
HPDF_UINT page_height = 400;
HPDF_UINT page_width = 400;
const char *detail_font_name;
strcpy (fname, "encoding");
strcat (fname, ".pdf");
pdf = HPDF_New (error_handler, NULL);
if (!pdf) {
printf ("error: cannot create PdfDoc object\n");
return 1;
}
if (setjmp(env)) {
HPDF_Free (pdf);
return 1;
}
page = HPDF_AddPage (pdf);
detail_font = HPDF_GetFont(pdf, "Times-Roman", "ISO8859-5");
HPDF_Page_BeginText (page);
/* move the position of the text to top of the page. */
HPDF_Page_MoveTextPos(page, 10, 280);
HPDF_Page_SetFontAndSize (page, detail_font, 16);
HPDF_Page_MoveTextPos (page, 0, -20);
HPDF_Page_ShowText(page,"регистратор температуры ");
HPDF_Page_SetWidth (page, page_width);
HPDF_Page_SetHeight (page, page_height);
/* finish to print text. */
HPDF_Page_EndText (page);
HPDF_SaveToFile (pdf, fname);
/* clean up */
HPDF_Free (pdf);
return 0;
}
I get a abnormal pdf with Russian text.
How to solved this problem? My source files encoding is not available? I can get a normal pdf with Russian text by utf-8 encoding but the font is embeded in my PDF ,so i can not choose utf-8.