用PYTHON批量將PDF保存為圖片

来源:互联网 发布:mac上的qq截图快捷键 编辑:程序博客网 时间:2024/06/01 09:31
__author__ = 'kong'#!/usr/bin/env pythonimport PythonMagickfrom PyPDF2 import PdfFileReaderfor j in range(0,23):    print(j)    if j<10:        oclock="0"+str(j)    else:        oclock=str(j)    pdffile = "C:\Users\kong\Desktop\950hPa\\2006to2011,05,"+oclock+"UTC950.pdf"    reader = PdfFileReader(file(pdffile, "rb"))    npage = reader.getNumPages()    for i in range(0, npage):        im = PythonMagick.Image(pdffile + '['+ str(i) +']')        im.write(pdffile[0:-4] + '_' + str(i)+ '.png')


Reference: 

http://walkerqt.blog.51cto.com/1310630/1411848/

0 0
原创粉丝点击