問題1:編程環境windows7,anaconda python3.5 DLL問題,我在程序中更新了 vs2015,後基本可以調用PyMuPDF了
問題2有很多網友包括知乎的網友說PyMupdf有bug,中文有亂碼!其實這是誤解!只需要修改字符庫即可。
這是結果:
下面是代碼:
# -*- coding:utf-8 -*- import fitz #import sys,os ofn = 'C:/3.pdf' b = u'你好! hello !' width, height = fitz.PaperSize("a4") fontsz = 10 lineheight = fontsz * 1.2 ffile = "C:/windows/fonts/msyh.ttf" font = "F0" doc = fitz.open() doc.insertPage(-1, fontsize = fontsz, text = b, fontname = font, fontfile = ffile, width = width, height = height) doc.save(ofn, garbage=4, deflate=True) doc.close()