Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

covert docx to pdf with libraoffice in python

from subprocess import  Popen
LIBRE_OFFICE = r"C:Program FilesLibreOfficeprogramsoffice.exe"

def convert_to_pdf(input_docx, out_folder):
    p = Popen([LIBRE_OFFICE, '--headless', '--convert-to', 'pdf', '--outdir',
               out_folder, input_docx])
    print([LIBRE_OFFICE, '--convert-to', 'pdf', input_docx])
    p.communicate()


sample_doc = 'file.docx'
out_folder = 'some_folder'
convert_to_pdf(sample_doc, out_folder)
Source by www.py4u.net #
 
PREVIOUS NEXT
Tagged: #covert #docx #pdf #libraoffice #python
ADD COMMENT
Topic
Name
7+7 =