0

I use python to write code to convert docx to pdf, but I get this error: On Windows: pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Word', 'Command failed', 'C:\Program Files (x86)\Microsoft Office\Office12\ 1033\WDMAIN11.CHM', 36966, -2146824090), None) On MAC: The program automatically opens that docx file and cannot convert it. I need your help!

i use python 3.12 and pycharm ide, installed docx2pdf

updated: I'm dowload plugin from microsoft: SaveAsPDFandXPS and install, because MS Office need this pugin to convert, that all, thankyou

1 Answers1

0

I recommand you use Python Version 3.10.8 below.
Because Python Version 3.12.0 is Only developer beta.

you follow me. it's very simple.
pip install python-docx
You do it on cmd(terminal).

import docx

# Open the .docs file
doc = docx.Document('document.docs')

# Save the file as pdf
doc.save('document.pdf')
Min
  • 80
  • 8