pdf回転画像(pngハイビジョン)

605 ワード


     ,     
1、  :windows(Linux       )
2、python  :3.6
3、    :PyMuPDF(pip install pymupdf)
     

import fitz

#    PDF  ,      
doc = fitz.open(r'C:\Users\123\Desktop\hangxianpdf\today\   .pdf')

print(doc.pageCount)

for pg in range(doc.pageCount):
    page = doc[pg]
    rotate = int(0)
    #           2,                 。
    zoom_x = 4.0
    zoom_y = 4.0
    trans = fitz.Matrix(zoom_x, zoom_y).preRotate(rotate)
    pm = page.getPixmap(matrix=trans, alpha=False)
    pm.writePNG(r'C:\Users\123\Desktop\hangxianpdf\today\tu'+'{:02}.png' .format(pg))