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是生成图像的密度,决定图像的大小
![](https://img.haomeiwen.com/i6240909/238a2b181a57cf3c.jpeg)
![](https://img.haomeiwen.com/i6240909/0c485291834b50ad.jpeg)
网友评论