🔥A command line tool to generate PDF (using Flyingsaucer) or text files from csv data and Freemarker templates🔥
+--------------+ +--------------+
| CSV data | | FTL template |
+--------------+ +--------------+
| |
| |
v v
+--------------+ +--------------+ +--------------+ +--------------+
| CsvJDBC |---------->| Freemarker |----/--->| JSoup |--------->| FlyingSaucer |
+--------------+ +--------------+ +--------------+ +--------------+
| |
/ |
| |
v v
+--------------+ +--------------+
| TXT file | | PDF file |
+--------------+ +--------------+
  mvn clean package
  java -jar csv2pdf.jar <options>
| -csv_charset <arg> | CSV file charset (optional, default 'UTF-8') |
| -csv_extension <arg> | CSV file extesion (optional, default '') |
| -csv_file <arg> | CSV input file (optional, use instead -csv_query) |
| -csv_folder <arg> | CSV folder path (optional, default '.') |
| -csv_query <arg> | CSV query command (optional, use instead -csv_file) |
| -csv_separator <arg> | CSV separator character (optional, default ';') |
| -for_each | Generate one file per data record (optional, see notes below) |
| -ftl_encoding <arg> | FTL input file encoding (optional, default 'UTF-8') |
| -ftl_file <arg> | FTL input file |
| -pdf <arg> | PDF output file (optional, use instead -txt) |
| -dpi <arg> | PDF output file dpi (optional, default 96) |
| -txt <arg> | TXT output file (optional, use instead -pdf) |
| -txt_charset <arg> | TXT output file charset (optional, default 'UTF-8') |
- csv2pdf 2.0.0 and above uses freemarker's square bracket tag syntax and square bracket interpolation syntax.
- Iterate "rows" collection inside your template if you are not using the -for_each option
- You can use a templated output file name if using the -for_each option
- See the examples folder!
  java -jar csv2pdf.jar -csv_file data.csv -ftl_file template.ftl -pdf output.pdf
  java -jar csv2pdf.jar -csv_file data.csv -ftl_file template2.ftl -for_each -pdf 'output_${id}.pdf'