Q:
I've been writing a prototype and I've proven that PDFTron PDFTNET SDK
can do almost everything we need. The only thing that I haven't
figured out is how to remove embedded fonts (they're causing the file
to be too large).
----
A:
The whole code may look something like this:
... Init PDFNet ...
PDFDoc doc = new PDFDoc("in.pdf");
doc.InitSecurityHandler();
Doc 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.IsDict())
{ // Process only Fonts
DictIterator itr = obj.Find("Type");
if (itr == obj.DictEnd() ||
itr.Value().GetName() != "Font")
continue;
itr = obj.Find("FontDescriptor");
if (itr == obj.DictEnd()) continue;
if (!itr.Value().IsDict()) continue;
Obj fd = itr.Value();
fd.Erase("FontFile");
fd.Erase("FontFile2");
fd.Erase("FontFile3");
}
}
doc.Save(...)
doc.Close();
You could run the above loop only once (e.g. prior to split operation).