pypandoc icon indicating copy to clipboard operation
pypandoc copied to clipboard

make sure pypandoc works with latex engines other than pdflatex

Open starhh opened this issue 7 years ago • 4 comments

Hi, I am following the documentation to convert md file to pdf using below code, I am using python 3.6 on windows. I encounter below error to select a different --pdf-engine or install pdflatex\r\n'.

I do not want to install other dependency, Please assist. Thanks

output = pypandoc.convert(input, 'pdf', outputfile='paper.pdf', extra_args=['-V geometry:margin=1.5cm'])

Traceback (most recent call last): File "C:/Users/star/Desktop/pdf_report/pypan.py", line 16, in output = pypandoc.convert(input, 'pdf', outputfile='demo.pdf') File "C:\Users\star\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pypandoc_init_.py", line 69, in convert outputfile=outputfile, filters=filters) File "C:\Users\star\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pypandoc_init_.py", line 325, in _convert_input 'Pandoc died with exitcode "%s" during conversion: %s' % (p.returncode, stderr) RuntimeError: Pandoc died with exitcode "47" during conversion: b'pdflatex not found. Please select a different --pdf-engine or install pdflatex\r\n'

starhh avatar Feb 22 '18 19:02 starhh

Also I tried with paramter --pdf-engine=xelatex'

output = pypandoc.convert(input, 'pdf', outputfile='paper.pdf', extra_args=['-V geometry:margin=1.5cm', '--pdf-engine=xelatex'])

https://pandoc.org/MANUAL.html#creating-a-pdf

starhh avatar Feb 22 '18 21:02 starhh

@starhh Does it work with extra_args=['-V geometry:margin=1.5cm', '--pdf-engine=xelatex'] or extra_args=['-V geometry:margin=1.5cm', '--pdf-engine=/usr/bin/xelatex'] (or wherever your xelatex is installed)?

jankatins avatar Apr 29 '18 17:04 jankatins

You need to separate the parameters, so: extra_args=['-V geometry:margin=1.5cm', '--pdf-engine=/usr/bin/xelatex'] becomes: extra_args=['-V', 'geometry:margin=1.5cm', '--pdf-engine', '/usr/bin/xelatex']

GeoSpark avatar Jan 25 '19 14:01 GeoSpark

I am using downlaod_pandoc(), but there is no method provided to download pdf-engine. Pandoc died with exitcode "41" during conversion: pandoc: pdflatex not found. pdflatex is needed for pdf output.

ylz-at avatar May 28 '21 05:05 ylz-at