davidverweij / csv2docx

Generates .docx files from .csv files using a .docx template with mailmerge fields
MIT License
5 stars 0 forks source link

Add word to PDF option #2

Open jawrainey opened 4 years ago

jawrainey commented 4 years ago

Use docx2pdf to batch convert the generated .docx documents into .pdfs. In my experience, I had to run docx2pdf once, grant access to Microsoft Word, and could then run the whole batch nicely. I first moved all generated .docx to a folder to use the folder-batch from docx2pdf easily. I might turn this together into a bash script in the future.

@davidverweij -- that would be really useful. Maybe you could expand your CLI to pipe the output into docx2pdf:

poetry csv2docx <params> | poetry docx2pdf <params>

*Assuming your programme has a name change to docx-csv-mailmerge

salmannotkhan commented 4 years ago

Look at requirement of docx2pdf. It says that user need MS Office in order to use this library. MS Office is not compatible with Linux so we can't use this library on Linux systems.

davidverweij commented 4 years ago

I found this alternative which works on all platform. It uses the unoconv library, though introduces the threshold to install Libre / Open Office. Then again, it can be run headless. Perhaps worth a consideration. Somewhere I feel we would be better off using Word for macOS and Windows, and perhaps Libre Office for Linux - instead of one for all, primarily due to the familiarity and user base of Microsoft Word.

davidverweij commented 4 years ago

I was just thinking, also in relation to #32, that I am curious to see the performance difference between:

  1. generate multiple .docx, and convert them all with e.g. docx2pdf, or
  2. generate one merged .docx (e.g. #32), convert that one with docx2pdf, and then split the pdf with something like this.

Especially since docx2pdf in my own experience seems to 'open' each .docx. Probably has a convertion point depending on the amount of .docx to be generated.