ninjacode
ninjacode

Reputation: 326

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

I want to convert my word .docx file to pdf using Python.

import os
import pypandoc
from django.http import FileResponse

newdir = os.path.abspath(os.path.join(os.path.dirname(__file__)))
if not os.path.exists(newdir):
    os.makedirs(newdir)
print(newdir)

file_name = os.path.join(newdir, 'test.docx')
pdf_filename = file_name.split(".docx")[0]
pdf_file = pypandoc.convert_file(file_name, 'pdf', format='docx', outputfile=pdf_filename + ".pdf", extra_args=['--pdf-engine=pdflatex'])
pdf = open(pdf_filename + ".pdf", 'rb')
response = FileResponse(pdf)
return response

I have already installed pdflatex and pylatex but I'm getting the error- RuntimeError: Pandoc died with exitcode "47" during conversion: pdflatex not found. Please select a different --pdf-engine or install pdflatex

Upvotes: 0

Views: 1001

Answers (0)

Related Questions