creative designer

There's a great JavaScript library for generating PDF files that I've always wanted to build something with. The output won't be anywhere near as pretty as using Scripting for Adobe Indesign but could be a good fit to generate a PDF for bulk Order Printing in Shopify.

The post is mainly going to apply to Shopify and Order Printing so if you're coming here for deep dive into JSPDF you've come to the wrong place. You might still get some value out of it but I want to spare you before you go too far down the rabbit hole.

This is an ongoing post as I tinker with things and may never be 100% complete. Who knows, it might become another browser extension, or may just live here in this post forever.

The code

Right now I am just running this directly in the Admin. This isn't a habit you should get into as running random scripts in your Admin can make a whole lot of things go wrong for you, your orders, customers, etc. The only people that should attempt should be those that understand the code and have staging environments for testing.

The better process would be to have your app grab the data from the API and then the JS can run on that data. Nice and safe that way.

Example PDF

Single page example. The example itself was pulled from the orders API resource docs on the Shopify site. I've run the code for 250 orders and it only takes a few seconds to process and create. Since those stores had real data I can't share that version, so you're stuck with the single page instead.

 

Like to work with me?

Let's talk