1 year ago

#286223

test-img

kmp

How to convert pdf to doc/docx and vice versa in python

I want to convert doc/docx file into pdf , make some changes in file and convert pdf back to doc/docx using python. To convert to pdf docx2pdf can be used but pdf cant be saved to file. I need to read keep converted file in memory, not sure how to read the converted pdf into fitz module. (same for pdf to docx , pdf2docx module is used to convert pdf file into docx but how to read converted docx to stream ?

docx to pdf :

from docx2pdf import convert
convert("input.docx")
convert("input.docx", "output.pdf")

pdf to docx:

from pdf2docx import parse
pdf_file = "test.pdf"
word_file = "test.docx"
parse(pdf_file, word_file, start=0, end=None)

python

pdf-conversion

0 Answers

Your Answer

Accepted video resources