https://github.com/redking00/csv2pdf
🔥A command line tool to generate PDF and text files from csv data and Freemarker templates.🔥
https://github.com/redking00/csv2pdf
cli command-line-tool csv easy-to-use flyingsaucer freemarker ftl java pdf pdf-generation templated-content text-generation
Last synced: 11 months ago
JSON representation
🔥A command line tool to generate PDF and text files from csv data and Freemarker templates.🔥
- Host: GitHub
- URL: https://github.com/redking00/csv2pdf
- Owner: redking00
- Created: 2020-03-19T13:09:15.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2025-03-14T06:43:57.000Z (about 1 year ago)
- Last Synced: 2025-03-30T07:22:35.186Z (12 months ago)
- Topics: cli, command-line-tool, csv, easy-to-use, flyingsaucer, freemarker, ftl, java, pdf, pdf-generation, templated-content, text-generation
- Language: Java
- Homepage:
- Size: 521 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# csv2pdf

🔥A command line tool to generate PDF (using Flyingsaucer) or text files from csv data and Freemarker templates🔥
#### How it works?
+--------------+ +--------------+
| CSV data | | FTL template |
+--------------+ +--------------+
| |
| |
v v
+--------------+ +--------------+ +--------------+ +--------------+
| CsvJDBC |---------->| Freemarker |----/--->| JSoup |--------->| FlyingSaucer |
+--------------+ +--------------+ +--------------+ +--------------+
| |
/ |
| |
v v
+--------------+ +--------------+
| TXT file | | PDF file |
+--------------+ +--------------+
### Build:
  mvn clean package
### Usage:
  java -jar csv2pdf.jar <options>
### 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_eachGenerate 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')
### NOTES:
- 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!
#### Example 1:
  java -jar csv2pdf.jar -csv_file data.csv -ftl_file template.ftl -pdf output.pdf
#### Example 2:
  java -jar csv2pdf.jar -csv_file data.csv -ftl_file template2.ftl -for_each -pdf 'output_${id}.pdf'
### Any idea, suggestion or comment is always appreciated