Skip to content

Instantly share code, notes, and snippets.

@badjano
Created December 5, 2020 03:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save badjano/206527c180aaf6522225bfb7243c68c5 to your computer and use it in GitHub Desktop.
Save badjano/206527c180aaf6522225bfb7243c68c5 to your computer and use it in GitHub Desktop.
import fitz # pip install pymupdf
pdffile = "file.pdf"
doc = fitz.open(pdffile)
for i in range(doc.pageCount):
page = doc.loadPage(i)
zoom = 5
pix = page.getPixmap(matrix=fitz.Matrix(zoom, zoom))
output = "file_%d.png" % i
pix.writePNG(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment