How to identify whether the fonts are embedded or not?

Q: Using PDFTron , how to identify whether the fonts are embedded or not? Could you please provide us with some sample code?

Ideally I would like to get a lost of all fonts in the PDF and information on whether each font is embedded or not.

DictIterator itr = obj.Find(“Type”);A: You can use font.IsEmbedded() to check if a font is embedded.

Your code to list all fonts in PDF may look along the following lines:

// C# pseudo-code (other languages are similar)

using (PDFDoc doc = new PDFDoc(“my.pdf”))

doc.InitSecurityHandler();

SDFDoc cos_doc = doc.GetSDFDoc();

int num_objs = cos_doc.XRefSize();

for (int i=1; i<num_objs; ++i) {

Obj obj = cos_doc.GetObj(i);

if (obj!=null && !obj.IsFree()&& obj.IsStream()){

if (!itr.HasNext() || !itr.Value().IsName() || itr.Value().GetName() != “Font”) continue;

pdftron.PDF.Font fnt = new pdftron.PDF.Font(obj);

if (fnt.GetSDFObj() == null) continue;

bool is_embedded = fnt.IsEmbedded();

}

}

}