3

First time posting here,by the way, i've got an issue with this particular line of Python (3.6) code:

file_converted = pandoc.convert_file(PATH_TO_ODT, 'pdf', format="odt", outputfile=file_name + ".pdf", extra_args=['--pdf-engine=pdflatex'])

When i execute the script (to convert a .odt file to a .pdf file) , i encounter the following error :

RuntimeError: Pandoc died with exitcode "47" during conversion: b'pdflatex not found. Please select a different --pdf-engine or install pdflatex

Basically i understand that i need "pdflatex" , but after i've installed it via pip with the command

pip install pdflatex, the execution produce the same error message, what i should do or check? thank you all.

mb21
  • 34,845
  • 8
  • 116
  • 142
Paul
  • 33
  • 1
  • 4
  • Using another pdf-engines among the names pypadoc itself support it produces antoher error: `RuntimeError: Pandoc died with exitcode "1" during conversion: b'pdf-engine wkhtmltopdf is not compatible with output format latex` – Paul May 21 '19 at 16:51
  • I'm using **ubuntu 18.04** , thanks – Paul May 24 '19 at 14:19

2 Answers2

1

For pypandoc, which simply calls the pandoc commandline program, which in turn calls pdflatex, you should probably install LaTeX system-wide. On Ubuntu, that is:

sudo apt install texlive
mb21
  • 34,845
  • 8
  • 116
  • 142
  • [ IT WORKS ] After the installing of texlive as you suggested me, i've run the following line of code `pandoc.convert_file(PATH_TO_ODT, 'pdf', format="odt", outputfile=".pdf", extra_args=['--pdf-engine=pdflatex'])` , and it finally works. @mb21 thank you very much, straight to the point and effective. Thanks – Paul May 27 '19 at 13:56
0

MB21:: Pandoc actually does its own conversion - very involved algorithm. I viewed a presentation of the main author (John MacFarlene) recently, pandoc actually translates the source to it's own internal format, AST. From AST format, it is able to convert to a long list of document formats. So, pandoc doesn't just invoke pdflatex.

user3752062
  • 61
  • 1
  • 4