Commit 7b18a2d6 authored by Gabriel Couture's avatar Gabriel Couture

Adding prof of concept

parents
Pipeline #731 failed with stages
import subprocess
import docx2pdf
from mailmerge import MailMerge
FILEPATH = './tests/data/page_garde_publipostage.docx'
with MailMerge(FILEPATH) as document:
fields = document.get_merge_fields()
document.merge(
num_copieur_clinique='1234',
nom_md_famille_ou_ips='Couture',
pr_nom_md_famille_ou_ips='Gabriel'
)
docx_filepath = './tests/data/page_garde.docx'
output_dir = './tests/data'
pdf_filepath = f'{output_dir}/page_garde.pdf'
document.write(docx_filepath)
try:
docx2pdf.convert(docx_filepath)
except NotImplementedError: # Not implemented on linux
process = subprocess.Popen(['libreoffice', '--headless', '--convert-to', 'pdf', docx_filepath, '--outdir', output_dir])
process.communicate()
,gacou54,obiwan,16.10.2020 10:34,file:///home/gacou54/.config/libreoffice/4;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment