文件读取与存储

PDF

1.通过fitz

import fitz

#读取文件
path = 'xx.pdf'
file_handle = fitz.open(path)
#读取stream
pdf_stream = b'xxxxxx'
file_handle = fitz.open(stream=pdf_stream, filetype='bytes')

#保存为文件
output_file = 'XX.pdf'
file_handle.write(output_file)
#保存为stream
out_pdf_stream = file_handle.write()

 

posted @ 2020-12-21 11:33  GoonerWHM  阅读(90)  评论(0编辑  收藏  举报