PyMuPDF DLL问题和乱码问题
问题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()