简体   繁体   中英

Get a font and font size from text?

I want to make an application for auto finding font.

Therefore, I try to get a font and font size from PDF text with Acrobat SDK.

I examined samples and documents, but I could not find it.

 CAcroPDDoc pdDoc = new AcroPDDocClass();
 pdDoc.Open(filename);
 Object jsObj = pdDoc.GetJSObject();
 Type T = jsObj.GetType();

 // no idea for getting font and font size...

My tools : Visual Studio, C#, Acrobat DC, Acrobat DC SDK

  • For example PDF text, font and font size on Acrobat DC 在此处输入图片说明

Best regards

Acrobat JavaScript and, therefore, the JSO doesn't have access to the properties of text in the page content. The best you're going to be able to do is infer the size from the bounding box height but that won't be accurate since the bbox includes the leading. You can't get the font name at all.

You can get that information if you create a plugin but that would require C++ which you don't have listed as an option in your question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM