+ 2

How to generate pdf file from existing csv file by using python language..?

6th Mar 2018, 2:17 PM
Siva Brahma Chari Penuvarthi
Siva Brahma Chari Penuvarthi - avatar
2 Antworten
+ 7
I know that's perhaps not the best and cleanest solution, but it works and is highly customizable: 1. use pandas to read the .csv to a DataFrame 2. use pandas to save the .csv to .html 3. use pdfkit to convert the .html to .pdf import pandas as pd import pdfkit as pdf csv_file = 'myfile.csv' html_file = csv_file[:-3]+'html' pdf_file = csv_file[:-3]+'pdf' df = pd.read_csv(csv_file, sep=',') df.to_html(html_file) pdf.from_file(html_file, pdf_file) Of course once you convert to HTML, you can do stuff to it, so it looks nicer, than just pure basic font, if that is your desire. Ultimate PDF should incorporate that.
6th Mar 2018, 7:40 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 46
In my opinion it's a better way to create a new code and post a link. It is easier to read the code and to comment it and you can reffer to it in the future too.
6th Mar 2018, 9:30 PM
Worm
Worm - avatar