1

I'm currently making a program in python that creates data and then gets stored into a text file. The data is in a column like formation and when i change the file format to csv, it opens LibreOffice Calc (raspberry pi's version of excel) which is exactly how i wanted the data to be formatted.

But i want to take it one step further and convert my CSV file data into a PDF. I've looked on the web and it says how to convert a pdf into a csv which isn't what i want. I also saw something called pyPDF but im not sure about if that would be of any use.

This is the string of data that is being looped 10 times,

resultStr = 'Test,{},InNum,{},stats,{},Duration(ms),{} \n'.format("OFF",inPin, result, round(duration*1000))

Once the loop finishes, a text file gets opened and the 'resultStr' is the string is getting stored.

Thanks everyone for your help,

~Neamus

Neamus
  • 198
  • 1
  • 3
  • 16

1 Answers1

1

Using ReportLab, you can programatically generate PDF documents with your data. There are plenty of examples available to demonstrate the framework and how to use it. In your case, you should simply append to your document story in a loop for each of your CSV result strings.

J. Blackadar
  • 1,821
  • 1
  • 11
  • 18