0

I am trying to deploy a python dash app to Heroku server. I perform some calculations based on user input and I create a docx report (I have a specific .docx template and I fill it with data each time). My problem is that before sending that report to the user, I want to convert it to pdf. I was already using for offline use, docx2pdf however I do not know if heroku has word embedded. Apart from that, I do not want to save the .docx and then convert it to pdf and then delete that .docx. I want to do all the conversions when the files are in memory, not stored.

Can you suggest me any other way to do that?

I tried docx2pdf without success, and I do not want this approach either because I have to save the file.

I tried another solution that I found, conver the docx to html and then to pdf with pdfkit, but the conversion from docx to html really messed up the document.

I also tried several other minor libraries without success.

Denis Cornehl
  • 4,104
  • 1
  • 20
  • 24
  • Why don't you create a PDF file directly? There are some very good Python packages for doing that, including reportlab and fpdf. – Tim Roberts Feb 17 '23 at 23:23

0 Answers0