pdf-made-easy
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

PDF Made Easy

PDF Made Easy (PME) is a CLI application and library for developing and creating PDF documents.

Demo

Rationale

There are tons of PDF-generation tools out there. So, why make another one?

Well, I wanted an easy way to make customizable resumes. My previous solution, Polymorphic Resume, was overengineered to oblivion and cumbersome to use. So, I set out and looked at alternative solutions (e.g., resume-cli, electron-pdf, pdfgen, document-generator, ezPDF), but none matched all of the things that I was looking for, which are:

  • Use web technologies rather than TeX-based solutions to generate PDFs
  • Freedom to easily put whatever data in whatever template I want
  • Real-time preview of document changes in PDF format rather than in an intermediate format like HTML

Thus, PME was born.

How it works

To fulfill the requirements that I was looking for, the PME CLI takes data from a YAML, JSON, JSON with Comments (JSONC), or JSON5 file and injects it into a template to generate HTML which is then used to generate a PDF using Puppeteer. This process is repeated whenever there are changes to either the data or template file so that the PDF preview can refresh automatically.

Currently, the autorefresh feature only works if the viewer used to preview the PDF supports repainting when there are changes to the PDF file. However, in the future, it is planned to add an auto-reloading viewer together with the CLI to make previewing changes more streamlined.

Requirements

Installation

Global

npm install --global pdf-made-easy

Local

npm install pdf-made-easy

Usage

TODOs

Documentation

  • [ ] Finish documentation
  • [ ] Add examples

Tests

  • [ ] Migrate CLI tests to JavaScript
  • [ ] Add more CLI tests
  • [ ] Add unit tests
  • [ ] Add tests for type definitions

CLI

  • [x] Custom template engine via a getTemplateRenderer method in the config file
  • [ ] Auto-reloading preview of the generated PDF via a --preview or -p option
  • [ ] Using a separate stylesheet via a --style or -s option
  • [ ] Serving local assets for PDF embedding via --serve and --port options (ideas for implementation: 1, 2)
  • [ ] Multiple data and template inputs and PDF outputs via an entries property in the config file

API

  • [x] Make the getTemplateRenderer command argument optional

Contributing

If you find anything wrong or would like to suggest changes, issues and pull requests are welcome. Additionally, help with implementing the todos would be appreciated.

Versioning

This project adheres to the Semantic Versioning 2.0 Specification.

License

Copyright 2023-present Matthew Espino

This project is licensed under the Apache 2.0 license.

Package Sidebar

Install

npm i pdf-made-easy

Weekly Downloads

0

Version

0.2.0

License

Apache-2.0

Unpacked Size

33.9 kB

Total Files

7

Last publish

Collaborators

  • mcecode