I suspect much time to be wasted on "Start LibreOffice/Writer, (do the job), Close LibreOffice" "Start LibreOffice/Writer, (do the job), Close LibreOffice" "Start LibreOffice/Writer, (do the job), Close LibreOffice" etc.Īs a comparison: here: the export time is said to be either 90ms or 810ms. Print('PDF generated in %.1f sec' % (time.time()-t0)) nocrashreport -nodefault -nofirststartwizard -nolockcheck -nologo -norestore"' % i) Subprocess.call(r'C:\Program Files\LibreOffice\program\soffice.exe -headless -convert-to pdf test%i.docx -outdir. Install python3 pygments packages: sudo dnf install python3-pygment renaming the otx prior to adding the extension to libreoffice: mv ea4db15fcodehighlighter.oxt codehighlighter. Paragraph.text = ('', str(i))ĭoc.save('test%i.docx' % i) # these 4 previous lines are super fast - a few ms The following code works but it’s quite slow (3.3 seconds on average for each PDF document): import subprocess, docx, time # first do: pip install python-docx
0 Comments
Leave a Reply. |