0

Yes,I have to ask another question. I just want to generate a pdf with Russian text and I find libharu-RELEASE_2_3_0 that can help me . by the code:

    HPDF_UseUTFEncodings(pdf);
HPDF_SetCurrentEncoder(pdf,"UTF-8");
detail_font_name = HPDF_LoadTTFontFromFile (pdf, "ttfont/arial.ttf", HPDF_TRUE);
/* add a new page object. */
page = HPDF_AddPage (pdf);
detail_font = HPDF_GetFont (pdf, detail_font_name, "UTF-8");
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, "Об были вероломно программном чем");

it works for me ,but it embeds the font into the pdf .So the pdf size is too big, and I want to know how to generate pdf without embedding the font.

If I can not use utf-8 ,how can I get a pdf with Russian text. Any Russian friends here?

Here is a same question but get no answer utf8 in libharu: is embedding fonts really necessary?

  • Does this answer your question? [German text not proper on PDF created by Libharu C++](https://stackoverflow.com/questions/41125242/german-text-not-proper-on-pdf-created-by-libharu-c) – SimonC Dec 02 '19 at 10:01
  • thank you. I have read your link .That's problem is not same with mine.I know the source file should be UTF-8 style.I just want to get a pdf without embedding the font. I am from China, I do not know if I describe my question clearly. >_<... – yangkunvanpersie Dec 02 '19 at 12:33

1 Answers1

0

" I want to know how to generate pdf without embedding the font."

  • detail_font_name = HPDF_LoadTTFontFromFile (pdf, "ttfont/arial.ttf", HPDF_FALSE); that's it.

If you do not wanna use UTF8, then you should know the encoding of your text, for example, if you hard code in your source code, it's very likely that visual studio will encode them in UTF8, then you have to use UTF-8.

If you load texts dynamically, you should specify a correct encoding name for you text.

l.yang
  • 11
  • 2