|
- import fitz
-
- def ofd_to_pdf(file_path):
- doc = fitz.open(file_path)
- pdf_bytes = doc.convert_to_pdf()
- with open(file_path[:-4] + ".pdf", "wb") as f:
- f.write(pdf_bytes)
-
- def pdf_to_ofd(file_path):
- doc = fitz.open(file_path)
- ofd_bytes = doc.convert_to_ofd()
- with open(file_path[:-4] + ".ofd", "wb") as f:
- f.write(ofd_bytes)
-
- ofd_to_pdf("发票-01885817.ofd")
|