PDF矿工 - 提取字体大小? [英] PDF miner - extract font size?

查看:402
本文介绍了PDF矿工 - 提取字体大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇,如果可以使用pdfminer来提取字体大小。我认为这将有助于分离出不同的部分。我知道有下面的讨论,但我很好奇,如果有可能使用pdfminer





pdfminer文档说有可能 http:// www .unixuser.org /〜euske / python / pdfminer /

但是当我输入他在命令行后,我只是得到一个纯文本文档。

  pdf2txt.py -o output.html samples / CentolaCV.pdf 

例如..

  2008-13麻省理工学院斯隆管理学院助理教授

2006-08哈佛大学卫生政策学院Robert Wood Johnson学者

2001-02布鲁金斯学会访问学者


解决方案

尝试使用 -t 指定文件输出类型, flag:

pdf2txt.py -o output.html -t html samples / CentolaCV.pdf



这应该返回一个带有style属性font-family和font-size的html文件。
$ b 编辑 strong>:实际上,看起来输出结尾可以指定outfile类型,而不需要 -t 标志。你能链接到PDF文件,你试图提取字体样式?


I'm curious if it's possible to use pdfminer to extract font size. I think this would be helpful for separating out different sections. I know there's the discussion below, but I'm curious if it's possible to use pdfminer

Extract text from PDF in respect to formatting (font size, type etc)

the pdfminer documentation says it's possible http://www.unixuser.org/~euske/python/pdfminer/

but when i type in he following into the command line, i just get a plain text document. I don't see any font information.

pdf2txt.py -o output.html samples/CentolaCV.pdf

e.g...

2008-13  Assistant Professor, Sloan School of Management, M.I.T.  

2006-08   Robert Wood Johnson Scholar in Health Policy, Harvard University 

2001-02   Visiting Scholar, The Brookings Institution

解决方案

Try specifying the file output type with the -t flag:

pdf2txt.py -o output.html -t html samples/CentolaCV.pdf

That should return an html file with the style attributes font-family and font-size.

EDIT: actually, it looks like the output ending can specify the outfile type without the -t flag. Can you link to the pdf file that you're trying to extract font style from?

这篇关于PDF矿工 - 提取字体大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆