I'm looking at using PoDoFo to generate PDFs for OCR results in 
gImageReader. So far things are working pretty well, except for 
occasional encoding troubles. I.e. one char giving me headaches is fi 
(aka U+FB01).

If I don't specify and PdfEncoding in document.CreateFont, that 
character will not get printed. I noticed that if I use IdentityEncoding 
instead, the character is printed correctly, but the char spacing is 
wrong (i.e. spacing is about 150% the "normal" spacing). A small test 
application which demostrates this is appended below.

So my question is: How should I setup the font and encoding for correct 
results? I'll always be passing UTF-8 strings and it should also work 
for non-latin alphabets. I'm using PoDoFo 0.9.4 on Fedora.

Many thanks for any pointers.



#include <podofo/podofo.h>

int main()
     PoDoFo::PdfStreamedDocument document("test.pdf");
     PoDoFo::PdfPainter painter;

     PoDoFo::PdfString pdfString(reinterpret_cast<const 
     painter.SetFont(document.CreateFont("Dejavu Sans", false, false, 
false, PoDoFo::PdfEncodingFactory::GlobalIdentityEncodingInstance()));
     painter.DrawText(10, 10, pdfString);
     painter.SetFont(document.CreateFont("Dejavu Sans"));
     painter.DrawText(10, 50, pdfString);
     return 0;

Podofo-users mailing list

Reply via email to