search
LoginSignup
0

posted at

pymupdfを使ってpdfのwidthとheightを取得する

使用バージョン

python==3.8
PyMuPDF==1.19.6

やり方


import fitz

target_path = "xxx/yyy.pdf"
# pathlibを用いたパスでも良い

doc = fitz.open(target_path)

page_num = 0
page = doc.load_page(page_num)

pdf_width = page.rect.width
pdf_height = page.rect.height

参考文献

PyMuPDF公式ドキュメント

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
0