This solution doesn't work for me. Any other options?
EDIT
I have this:
string font = "resources//fonts//FreeSans.ttf";
PdfStreamedDocument document(output_pdf_name.c_str());
PdfPainter painter;
PdfPage* page;
page = document.CreatePage(PdfPage::CreateStandardPageSize(ePdfPageSize_A4));
painter.SetPage(page);
const PdfEncoding *pEncoding = PdfEncodingFactory::GlobalIdentityEncodingInstance();
PdfFont *f1 = document.CreateFont(font.c_str(), true, true, pEncoding);
PdfString eNtext("English text");
PdfString pLtext("Łódź stół");
painter.SetFont(f1);
painter.DrawText(100.0, page->GetPageSize().GetHeight() - 100.0, eNtext);
painter.DrawText(100.0, page->GetPageSize().GetHeight() - 150.0, pLtext);
painter.FinishPage();
document.Close();
and I see this in output pdf
If I set
string font = "resources//fonts//FreeSans.ttf";
PdfFont *f1 = document.CreateFont(font.c_str());
PdfString pLtext("\u0141\u00F3d\u017A st\u00F3\u0142");
I got
Hope, it will help to find the answer.
This code works for me:
PdfStreamedDocument document(output_pdf_name.c_str());
PdfPainter painter;
PdfPage* page;
page = document.CreatePage(PdfPage::CreateStandardPageSize(ePdfPageSize_A4));
painter.SetPage(page);
PdfString eNtext("English text");
PdfString pLtext(L"Łódź stół");
PdfFont* pFont = document.CreateFont("TIMES NEW ROMAN", false, new PdfIdentityEncoding(0, 0xffff, true));
painter.SetFont(pFont);
painter.DrawText(100.0, page->GetPageSize().GetHeight() - 100.0, eNtext);
painter.DrawText(100.0, page->GetPageSize().GetHeight() - 150.0, pLtext);
painter.FinishPage();
document.Close();
This is the most important part:
PdfString pLtext(L"Łódź stół");
PdfFont* pFont = document.CreateFont("TIMES NEW ROMAN", false, new PdfIdentityEncoding(0, 0xffff, true));
Best regards!