[0916 更新]
新增两个demo
http://coolwanglu.github.com/pdf2htmlEX/demo/cheat.html
http://coolwanglu.github.com/pdf2htmlEX/demo/geneve.html
完全去掉了boost
降低了C++11的依赖,GCC最低支持至4.4.6
支持超链接(文内链接精确到页)
解决了一部分字体编码问题
先上Demo:http://coolwanglu.github.com/pdf2htmlEX/demo/demo.html
还有大家可能会关心的CJKhttp://coolwanglu.github.com/pdf2htmlEX/demo/chn.html
项目主页:https://github.com/coolwanglu/pdf2htmlEX
感谢Arthur Titeica 提供 AUG Package
https://aur.archlinux.org/packages.php?ID=62426
传统pdf2html有两种:
一种相当于pdf2text加一些比较弱的格式,基本跟pdf2text也差不了多少
另一种是把所有渲染成图片然后嵌到一个html,结果是文字信息都丢失(不能选择,拷贝),生成的文件还巨大。
pdf2htmlEX结合二者优点,既保留了文字,又保留了格式。
具体来说有如下特性
1.从pdf提取字体
2.保证渲染准确性,针对web进行优化(包括减少文件大小,文字行合并,(为HTML文字选择)字体重编码等等)
3.其他内容用图片显示
4.单文件输出,一个HTML搞定一切
下载编译安装:
依赖:
较新的poppler (0.20.3),自己编译时记得加参数–enable-xpdf-headers
fontforge,需要git版本https://github.com/fontforge/fontforge ,因为有一些功能/bug是我开发pdf2htmlEX时提交的
boost c++库,具体依赖的组件见项目主页
cmake和支持c++11的gcc
欢迎各种意见,建议,fork,bug report
额……要fontforge的git版本,
直接用arch源20120731的了……
字体变化了……公式全乱套了
我新加的功能应该是8月份提交的。
你试试pdf2htmlEX --tmp-dir tmp --clean-tmp 0 --dest-dir out laser.pdf
然后fontforge -script tmp/f1.pe
最好贴一下
cat tmp/f1.pe
[lyy@arch laser]$ fontforge -script tmp/f1.pe
Copyright (c) 2000-2012 by George Williams.
Executable based on sources from 14:57 GMT 31-Jul-2012-ML-D.
Library based on sources from 14:57 GMT 31-Jul-2012.
The PostScript font name "宋体" is invalid.
It should be printable ASCII,
must not contain (){} <>%/ or space
and must be shorter than 63 characters
LoadEncodingFile: Wrong number of arguments
调用自...
tmp/f1.pe: 行 4
嗯,LoadEncodingFile的第二个参数就是最近加上的
所以还是需要安装github的版本。
reverland:
[lyy@arch laser]$ fontforge -script tmp/f1.pe
Copyright (c) 2000-2012 by George Williams.
Executable based on sources from 14:57 GMT 31-Jul-2012-ML-D.
Library based on sources from 14:57 GMT 31-Jul-2012.
The PostScript font name "宋体" is invalid.
It should be printable ASCII,
must not contain (){} <>%/ or space
and must be shorter than 63 characters
LoadEncodingFile: Wrong number of arguments
调用自...
tmp/f1.pe: 行 4
英文archlinux论坛上有人试成功了,上面新添了一个AUR。
你装个fontforge-git试试?
reverland:
coolwanglu:
reverland:
coolwanglu:
reverland:
中午还抱着试试看的心理没有装git版本的……
嗯,我这个搞的比较激进。不便于推广。。。
好东西,不会被这个阻碍推广……
那么你那边试成功了吗?
体谅下渣网速吧……fontforge还没下下来呢
我错了
不过我看archlinux的fontforge-git还是从sourceforge上下
fontforge已经移到github上了,也是上个月的事情,但是似乎sourceforge也在同步更新
也许你连github会快一点?
coolwanglu:
reverland:
嗯,很棒的效果……简直梦寐以求的东西啊。
太好了,恭喜。
建议demo弄个有公式的……发现公式字体效果非常棒
coolwanglu:
我觉得也是,现在的demo一点都不吸引人。
挺吸引人了,不然我也不会这么激动……特别是英文的,效果太漂亮了
最新devv分支已经不依赖git版本的fontforge了。
欢迎尝试