I tried the code you supplied in pdfmm: if the found font has all the required GIDs, and the standard14 Helvetica actually doesn't have all of them so I used Arial as a fallback, I can already handle the text correctly, see the attachment.
Cheers, Francesco On Sun, 24 Apr 2022 at 13:45, zyx <z...@gmx.us> wrote: > PdfMemDocument doc; > PoDoFo::PdfPage* pPage; > pPage = doc.CreatePage( PoDoFo::PdfPage::CreateStandardPageSize( > PoDoFo::ePdfPageSize_A4, false ) ); > PdfFont * pFont = doc.CreateFont( "Helvetica", false, false, > false, PdfEncodingFactory::GlobalWin1250EncodingInstance()); > TVecFilters filters; > PdfMemStream output(pPage->GetObject()); > output.BeginAppend(filters); > PdfPainter painter; > painter.SetPage(pPage); > painter.SetFont(pFont); > > PdfString str; > std::string ustr; > > str = PdfString("ěščřABCĚŠČŘ"); > ustr = str.GetStringUtf8(); > printf ("1) '%s'\n", ustr.c_str()); > pFont->WriteStringToStream(str, &output); > pFont->WriteStringToStream(ustr, &output); > > painter.DrawText(10, 780, str); > painter.DrawText(10, 740, ustr); > > str = PdfString((const pdf_utf8 *) "ěščřABCĚŠČŘ"); > ustr = str.GetStringUtf8(); > printf ("2) '%s'\n", ustr.c_str()); > pFont->WriteStringToStream(str, &output); > pFont->WriteStringToStream(ustr, &output); > > painter.DrawText(10, 700, str); > painter.DrawText(10, 660, ustr); > > painter.FinishPage(); > doc.Write("/tmp/test.pdf"); > > output.EndAppend(); > printf ("%s: wrote %d bytes: '%.*s'\n", __FUNCTION__, (int) > output.GetLength(), (int) output.GetLength(), output.Get()); > >
test-pdfmm.pdf
Description: Adobe PDF document
_______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users