Apr 9, 2023

PDF support is here!

With the rebuilt editor, Stencil now enables users to generate PDFs of their templates, providing a high-quality feature that has been highly requested by users.Try out this exciting new feature!

We have some exciting news to share with you all - Stencil can now generate PDFs of your templates! 🎉

We know that this is something many of you have been waiting for, and we wanted to make sure we got it right. So we took our time and rebuilt the editor from scratch to ensure we could deliver a quality PDF generation feature.

Our new editor is now up and running, and we're thrilled to say that the PDFs generated from templates built with it look absolutely stunning. 😍 While we can still generate PDFs for templates built with our old editor, the quality won't be quite as good as those built with the new one.

We'll be diving into the details of why that is soon, but for now, we hope you enjoy using this new feature! Try it out and let us know what you think.

Unlocking new use case

PDF generation allows for more diverse use case like creating simple invoices, certificates, shipping labels and many more.

How to generate a PDF

Generating a PDF follows a process similar to that of generating an image. If you're familiar with using our API to create images, you'll find yourself right at home with PDF generation.

New API

For this release, we introduce two new APIs.

1. POST https://api.usestencil.com/v1/pdfs

To generate a PDF, simply send a POST request. This call returns immediately, as PDF generation is done asynchronously.

Upon making the request, you'll receive an id in the response. This id can then be used with the next API call to check on the status of PDF generation. Alternatively, you can also specify a return url as the webhook.

Once the PDF has been generated, we'll notify you by calling the webhook you provided. So sit back, relax, and let us take care of the rest!

2. GET https://api.usestencil.com/v1/pdfs/:pdf_id

Send a GET request with the id from the previous API call to poll the status of PDF generation. You'll find the link to the generated PDF in the response if the status is completed.

JSON
{ "created_at": "2023-04-06T12:04:58.877Z", "id": "e45e9dc7-8eee-476c-9031-0d1040881d1a", "log": null, "metadata": {}, "modifications": [ { "name": "image_2", "src": "https://usestencil.s3.amazonaws.com/example.png" }, { "name": "text_3", "text": "YELLOW WOOL HOODIEZZ" }, { "name": "text_5", "text": "USD 49.99" } ], "pdf_url": "https://usestencil.s3.amazonaws.com/example.pdf", "self": "http://api.usestencil.test:4000/v1/pdfs/e45e9dc7-8eee-476c-9031-0d1040881d1a", "status": "completed", "template_id": "6132c433-aa49-4774-8eed-c402898f1437", "webhook_response_body": null, "webhook_response_code": null, "webhook_url": null }

Vectorized Text

Although we do offer support for the old template for generating PDFs, we strongly suggest that you utilize the new editor to create templates for PDFs.

The old editor renders content on a canvas, which implies that the text is transformed into a raster image and you will be unable to select the text.

Comparison between PDFs generated with the old and new templates. Text can be selected in the PDF on the left, generated with the new template.

Left is PDF generated with new template. Text can be selected.

The new editor properly embeds the font and provides an improved experience.

Documentation

For more details, please read our documentation here https://docs.usestencil.com/api/endpoints/pdfs

Integrations: Test Console, Forms, Zapier, Make, etc

Currently they are not yet supported but don't worry, we are working on adding support for PDF generation through these integrations too.

So stay tune! For Zapier, Make and other similar tools, you can still leverage on our API to automate PDF generation.

--

We couldn't be more thrilled about this new release as it unlocks so many possibilities for both us and our users. We hope you're just as excited as we are!

We invite you to give it a try and let us know what you think. Your feedback is invaluable to us and helps us improve our product for everyone. So don't hesitate to reach out and share your thoughts. We can't wait to hear from you!

Ready to dive in?Start your free trial today.