一个使用python库将PDF文件转换为对应的图片文件的程序

2017-06-01  本文已影响0人  d29ffe667cf2

ubuntu:16.04

#pdf to image

使用python的一些特殊的库来将pdf文件转换为对应的图片(.png)

##需要安装的库

###  Pypdf2:

http://blog.csdn.net/sweeper_freedoman/article/details/52994400

```

pip install pypdf2

```

### Pythonmagick:

http://blog.csdn.net/sweeper_freedoman/article/details/52994690

```

apt-get install python-pythonmagick

```

#Usage:

主程序为class_image.py

测试程序为test.py

运行方法:

```

python test a.pdf ./image/ 256

```

a.pdf是需要转换的.pdf文件的路径 ./image/是转换后输出图片的位置

256是生成图像的密度,决定图像的大小

上一篇 下一篇

猜你喜欢

热点阅读