pdfkit-fresh-resume
v1.1.0
Published
Convert a resume (CV) in FRESH format to PDF with PDFKit. This includes an example resume JSON and an example theme.
Downloads
3
Readme
Toolkit for rendering a resume PDF with PDFKit.
Convert a resume (CV) in FRESH format to PDF with PDFKit. This includes an example resume JSON and an example theme. Inspired by HackMyResume, but I wanted more low-level control over the PDF output.
The previous PDF version of my resume was generated with a FRESH resume JSON to XML to PDF with with XSL:FO and after every change I manually transform to PDF and have to close and open Adobe Reader (there is no refresh button and the PDF is locked when open in Reader so it will not overwrite when transforming). As a front-end developer I want to leverage browser sync to make the develop/review cycle more efficient.
The FRESH resume JSON, photo and the generated PDF for my own resume are not public, but I did include an example json (./example-resume.json), photo (./example-photo.jpg) and PDF (./output/example-output.png).
Details about how the preview is generated:
- A Node script runs when the sources change and generates the PDF, but also a JS with a data-uri version of the PDF as a variable.
- A static html preview.html is served that includes the data-uri JS.
- To do: Browsersync will be used to watch changes to the data-uri JS and will refresh preview.html in the browser.
Run
Because async/await is used, NPM 9 is required.
npm use 9
npm i
node index.js run examples/example-resume.json output.pdf
or globally:
npm use 9
npm i -g pdfkit-fresh-resume
pdfkit-fresh-resume run ~/.npm/pdfkit-fresh-resume/example-resume.json output.pdf
options:
- With alternative template:
pdfkit-fresh-resume run ~/.npm/pdfkit-fresh-resume/example-resume.json output.pdf -t ~/.npm/pdfkit-fresh-resume/app/template/otherTemplate.js
Running with -w/--watch
This is an experimental feature
pdfkit-fresh-resume run ~/.npm/pdfkit-fresh-resume/example-resume.json output.pdf -w
- Run
http-server
in another terminal - Open http://localhost:8080/preview.html in the browser
- After updating the template or the input JSON, the console will log "🔥Hot update". After that refresh the browser while clearing the cache to see changes.
TODO
- Implement a full template that can render an entire resume.json
- Linting: eslint app/**/*.js fails because pdf.js contains async and that is an experimental feature which can't be parsed by eslint directly, this might be fixed by using eslint-babel parser.
- See also https://github.com/MrRio/jsPDF (.docx support: https://github.com/MrRio/DOCX.js)