- Python 3 - download here
- pdfkit - to install run
pip install pdfkit - wkhtmltopdf - installation instructions here
The script takes an html template and a csv data file and produce a pdf file for each of the rows in the data file. The name of the generated file is: {firstColumnValueInDataFile}.pdf
Script can be run with:
python pdfContract.py {template} {csvDataFile} {outputFolder}
NOTE: the structure of the csv file is defined within the template
The templates for the script are defined in HTML and CSS
NOTE: the CSS for the template must be defined within the HTML file
Placeholders can be defined with the following syntax: [colx] where x is the column number (starting from 0) in the csv data file.
EXAMPLE: The template:
<html> <p>First name: [col0]</p> <p>Last name: [col1]</p> </html>and the data file:
Kristijonas,Zalyswould result in a pdf file: Kristijonas.pdf:
First name: Kristijonas Last name: Zalys