如何在Linux系统中利用node.js提取Word及PDF文本内容的案例介绍


当前第2页 返回上一页

用antiword提取 .doc 的内容

我们这里使用了 antiword 开源软件,来提取word2003以前版本的内容,安装同样非常简单:

1

apt-get install antiword

查看帮助:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

root@raspberrypi:/var/www# antiword

 Name: antiword

 Purpose: Display MS-Word files

 Author: (C) 1998-2005 Adri van Os

 Version: 0.37 (21 Oct 2005)

 Status: GNU General Public License

 Usage: antiword [switches] wordfile1 [wordfile2 ...]

 Switches: [-f|-t|-a papersize|-p papersize|-x dtd][-m mapping][-w #][-i #][-Ls]

  -f formatted text output

  -t text output (default)

  -a <paper size name> Adobe PDF output

  -p <paper size name> PostScript output

   paper size like: a4, letter or legal

  -x <dtd> XML output

   like: db (DocBook)

  -m <mapping> character mapping file

  -w <width> in characters of text output

  -i <level> image level (PostScript only)

  -L use landscape mode (PostScript only)

  -r Show removed text

  -s Show hidden (by Word) text


antiword直接将word内容输出到了console中:


1

2

3

4

5

root@raspberrypi:/var/www# antiword spec.doc

 

SYNC Mobile ?C Ford APA

Project Number: DFYST

Requirements Specification


同样在node.js用child_process调用此命令即可。

解析提取.docx 的内容

对于 docx 文档来说,因基本身就是一个zip文件,只需要在node.js先将其解压,再解析 text.docx\word\document.xml 文件即可。

总结

以上就是如何在Linux系统中利用node.js提取Word及PDF文本内容的案例介绍的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

如何查看linux是否安装了gcc

linux系统中如何添加路由

linux怎么查看mysql安装在哪里

linux中如何查看数据库

如何快速简单的在安全组内查询安全组详情

linux如何上网

telnet到redhat linux失败原因、解决方法

如何使用bandwidthpackageitemtype共享带宽包描述信息

为磁盘创建快照之后怎么查看快照容量

linux中怎么配置ip

更多相关阅读请进入《javascript》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...