Tutorial: Making PDF's in Retool

Hi all!

@KLP and the Bold Tech team just made this neat tutorial on how to make PDFs in Retool and wanted to share. :slight_smile: I know @bradlymathews also has one on carbone.io for generating reports. You can find his here: How to Print a PDF?

Here is the gist if you don't have time to read it (the tutorial goes in-depth for all of these)

  • Within Retool, you can use the resource query option, ‘PDF Exporter’, to make PDFs using Markdown. The PDFs can be downloaded directly to your PC, but it isn’t possible to generate unique file names, and, as it does not allow for HTML, formatting can be an issue.
  • Also directly in Retool, the ‘downloadPage utility’ can be run using a JavaScript query to generate PDFs of all or part of your current Retool page, much like a screenshot. It allows unique filename generation, but if you require formatting above and beyond what is on the current Retool page you will find this quite limiting.
  • An external API for PDF generation (such as APITemplate) can help you to overcome the drawbacks of the first two methods, if what you are looking for is more elaborate formatting capabilities and the ability to easily reference your Retool data in the PDFs (which is likely). It requires more steps to set up than the above two methods, but those steps are fairly straightforward and the benefit is getting a PDF that looks the way you want and includes the data you need.

You can read the full tutorial here: https://www.boldtech.dev/posts/creating-pdfs-in-retool

Let us know if there is a way that we should add or if you have any questions! :slight_smile:


Hey all! That's me!
I had a lot of fun making this tutorial and hope it helps some folks. Please don't hesitate to contact me if you have questions :grinning:


Thanks for sharing @KLP! APITemplate is an excellent product, let's give them a hand on Product Hunt! API Template - Generate images and PDFs with simple API | Product Hunt

1 Like

Hi @KLP ,
Thank you so much for writing down the tutorial. This helped me a lot to move forward in a project :grin:
Would you know how to insert dynamic images in the PDF based on URLs? Am a bit stuck here and would love some help :pray:

Hi Audrey,
I have not inserted dynamic images into my PDFs before so actually no idea off the top of my head. But I'm curious now and trying some things out - If I can make it work I'll let you know! :grinning:

1 Like

I'm also continuing on my end and will let you know if I also find a way out :smiley:


HI, I found your tutorial really instructional - thank you.

However I am struggling to get my data to "cycle" through in APITemplate.

I think the problem is the structure of the JSON data is in columns and not rows?

{ "Column1" : [Row1, Row2, Row3], "Column2" : [Row1, Row2, Row3] etc}

and not

{ [ ["Column1" : Row1, "Column2" : Row1],
["Column1" : Row2, "Column2" : Row2],
["Column1 : Row3, "Column3 : Row3], etc ] }

Any ideas how to solve this, either in Retool or in APITemplate?


Hey @jclutterbuck

You could try something like this in Retool {{formatDataAsArray(yourdatsaource.data)}}

This will turn your data from an object of arrays to an array of objects.

Hope that helps!


1 Like

Thank you, soooo much, that's exactly it. Couldn't find that from Googling! I'm so excited.

Thanks again