utils.downloadFile downloads empty PDF

I have a PDF viewer that is loading base64 encoded PDF data from MSSQL and it works great and the PDF displays properly. It pulls the base64 PDF data from:

However, I have a button below the PDF viewer that runs the following javascript to download the PDF:
utils.downloadFile(atob(pdfDataForSelectedInvoice.data['0'].icpdf),'Invoice #' + outstandingInvoicesTable.selectedRow.data['Invoice #'].trim(),'pdf')

But when I open the downloaded PDF, every page is pure white. What am I doing wrong?

Hey there,

I just tested this out on my end, and it seems like this might be a bug.

Some other users have found workarounds discussed here: http://community.retool.com/t/using-jspdf-from-html-in-sandbox/3908/7

I have created a bug report for this issue, and will report back here once the issue has been addressed!

@mark do you have a rough guess on when or if this bug might get fixed? Do you know if it's actively being worked on or is it just in a list waiting to be worked on?

Hey @socaljoker, it looks like it has not been picked up just yet, but I will see if I can increase the priority / get a timeline on a fix!

Thank you!

@socaljoker, can you try this syntax?

utils.downloadFile({base64Binary: pdfDataForSelectedInvoice.data['0'].icpdf },'Invoice #' + outstandingInvoicesTable.selectedRow.data['Invoice #'].trim(),'pdf')
1 Like

Works perfect! Thank you!!

Awesome! Glad we could get that working for you!