0

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?

Community
  • 1
  • 1
Victor.V
  • 177
  • 1
  • 9
  • 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 Mar 18 '16 at 00:27

1 Answers1

0

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
);
Olivier Pons
  • 15,363
  • 26
  • 117
  • 213
Victor.V
  • 177
  • 1
  • 9