0
votes

I am using PoDoFo library to generate a PDF document. All fonts except Base14 ones ("Courier", "Helvetica", "Times", "Symbol", "ZapfDingbats") are embedded. How to embed these 4 Base14 fonts?

1
You have to start by finding appropriate font files to embed: pdf libraries usually only bring along the metrics of those fonts, notre complete font files. - mkl

1 Answers

0
votes

By default the CreateFont() function uses the EFontCreationFlags::eFontCreationFlags_AutoSelectBase14 attribute (so it doesn't have to be given).

PoDoFo::PdfDocument *pDocument;
... 
pDocument->CreateFont("Times", false, false, false, 
    PoDoFo::PdfEncodingFactory::GlobalIdentityEncodingInstance(),
    PoDoFo::PdfFontCache::eFontCreationFlags_AutoSelectBase14
);

This attribute makes the function automatically check if the font is a Base14 one, and if it is, then PoDoFo doesn't embed the font. Use the PdfFontCache::eFontCreationFlags_None flag to embed the font.

PoDoFo::PdfDocument *pDocument;
... 
pDocument->CreateFont("Times", false, false, false,
    PoDoFo::PdfEncodingFactory::GlobalIdentityEncodingInstance(),
    PoDoFo::PdfFontCache::eFontCreationFlags_None
);