简体   繁体   English

从文本中获取字体和字体大小?

[英]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. 因此,我尝试使用Acrobat SDK从PDF文本中获取字体和字体大小。

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 我的工具:Visual Studio,C#,Acrobat DC,Acrobat DC SDK

  • For example PDF text, font and font size on Acrobat DC 例如Acrobat DC上的PDF文本,字体和字体大小 在此处输入图片说明

Best regards 最好的祝福

Acrobat JavaScript and, therefore, the JSO doesn't have access to the properties of text in the page content. Acrobat JavaScript,因此,JSO无法访问页面内容中文本的属性。 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. 您要做的最好的事情就是从边界框的高度推断出尺寸,但是由于bbox包含前导,因此这是不准确的。 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. 如果您创建插件,则可以获取该信息,但是需要使用C ++,而您在问题中没有将其列为选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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