Blog / Meet the PDFMonkey CLI: Your New Local Sidekick

Breaking News: We have a CLI now!

Hey everyone! We’re thrilled to roll out something absolutely game-changing for all you PDFMonkey enthusiasts: the PDFMonkey CLI. You can now edit your templates using your favorite local tools and environment, and with the help of AI tools like Cursor or GitHub Copilot.

CLI running in the terminal showing a template being synced

Why You’ll Love It

  • Local Development Freedom: No more copy-pasting code betwen online and local editors. Pull a template locally, and you’re all set.
  • Watch & Preview in Real-Time: Start “watching” your folder and you’ll see changes on the fly. Tweak the code, save, the preview refreshes automagically.
  • Team Collaboration for Free: Keep your template files in version control, share them with teammates, or let your AI assistant do the heavy lifting while you sip your coffee.
  • Conflict Resolution: The CLI automatically detects file conflicts and lets you decide how to handle them—no sweat, no tears.

A Quick Taste of the CLI

The CLI is distributed as an NPM package. It can be used as follows:

npm install -g @pdfmonkey/cli

export PDFMONKEY_API_KEY=YOUR-API-KEY

pdfmonkey init ID-OF-YOUR-TEMPLATE
pdfmonkey watch ID-OF-YOUR-TEMPLATE

The CLI runs a local server, so you can open the preview in your browser. Every time you save a file, the preview will refresh!

Code editor and template preview side-by-side

Easy inspection

In case you need to inspect the HTML generated by your template, we got you covered. Running then pdfmonkey watch -D command will provide an HTML preview instead of PDF one. Now you will know why this 🤬 image is not showing up!

There’s more!

We will not cover all of the features here, but you can find more information in the PDFMonkey CLI documentation.

Oh, and did we mention that it’s open-source? You can find the source code and open issues (or Pull Requests!) on GitHub.

Don’t hesitate to reach out if you have any questions or feedback, it will be very welcome!

Happy (local) Coding!

January 27, 2025
Simon Courtois
linkedin

Simon is passionate about development, tech, design and continuous enhancement. CTO and Co-Founder at PDFMonkey he supervises the development and evolution of the platform making sure the product always respects our core values.