Converting a MySQL Table to a PDF File

I have done some research into converting a MySQL table to a PDF file and I think I will eventually get this to work.
But if someone has already figured this out, I would be pleased to hear from you.

Mike

Hi @mdsmith1 Did you already implement this? One idea is to use the pdf exporter query type, as explored here

The pdf exporter is somewhat limited though. This blog post explores other ways to generate PDFs from Retool, such as a download button or using an external api :slightly_smiling_face:

Download button example:

Tess, I think this is probably all I need but I can't get it to work.

I am sending screen capture. I have asked it to print fields Field1, Field2, Fierld3 and Field4 and it just prints out these words as a header.

How does this work?

Mike

The PDF Content needs to be formatted as markdown, which is why I mentioned it can be very limited. There isn't much flexibility with styling and it can be tedious to map out the data you need properly.

Headers from table could be formatted like this:

const headers = [Object.keys({{ table1.data }}[0])];
const breaks = [headers[0].map(() => "---")];
const tableEntries = headers.concat(breaks);
return tableEntries.map((row) => "|" + row.join("|") + "|").join("\n");

Tess:

Yes this is complicated. I can get the .pdf file to download but it is not scrollable and does not print properly.
I have attached 3 screen shots to help you see what I am doing wrong.
Thanks
Mike