I have a document that I manually fill in on a regular basis - print it out, fill in the necessary blanks, and then finally give it to the intended person. This project facilitates my use-case for generating a PDF document based on a template and a set dictionary.
This project comprises of 3 modules that provide a way for the user to generate a PDF document from a template and a dictionary. The modules:
- eztemplate-core: API level library for template generation.
- eztemplate-pdf: A PDF implementation for template generation using iText.
- ezpdf: A simple UI that allows to user to specify a template and a dictionary to generate a translated PDF document.
Ez Pdf is a simple standalone, thick-client application that runs on the user's local machine. Application data is saved in $HOME/.ezpdf
which only includes a log file. Prebuilt application artifacts on Dropbox can be found below and support Mac, Windows and Linux.
- Create a text file template document with placeholders - i.e.
${tenantName}
- Create a properties dictionary file that maps placeholders to their value - i.e.
tenantName=Peter Parker
- Use
ezpdf
and pass in template and dictionary to generate the finalized document
Note: In the template, you can specify <%newpage%>
where you want a page break to occur.
Sample input files are included with this project.
- lease.txt - Example template text file.
- lease_empty.properties - Dictionary that fills in the lease above with empty blank lines - essentially the form for you to manually write in the values.
- lease.properties - Dictionary that fills in the lease above with sample values.
Gradle builds the application and uses the following plugins to build distributable artifacts.
- Gradle
distribution
- Spring
spring-boot
- crotwell MacApp Bundle
- Image icons for
ezpdf
are provided by xinhstudio.
gradle clean build
Navigate to eztemplate/ezpdf/build/distributions
where there will be the following files for running ezpdf in Mac/Unix/Windows environments:
dmg
file to install and run in Mac OSXtar
file packaged with the Unix and Windows runscripts along with all necessary dependencieszip
file which contains the same contents as thetar
file