Embedding pdf files retrieved from Data Tables

A little help from my fellow Anvil enthusiasts, please :slight_smile:

I would like to embed pdf-files in my app (for display, not download or display in a separate browser tab). If the pdf-file has an external url, this can of course be done using an iFrame component, but I would like to do something similar for pdf-files retrieved from Data Tables - alternatively from a Google Drive folder.

I realize that one option could be to use pdf2image server-side, but does anyone know if there’s a more direct way to do this client-side?

Any ideas would be much appreciated. Thanks.

Rufus

I had the same need, and it’s surprisingly tricky. I came up with a solution that uses a Custom HTML component to create an iframe with a Google Drive viewer. It shows a PDF I’ve stored in a a Data Table.

It winds up looking like this —

Here’s a clone-able example app: https://anvil.works/build#clone:35VXDFWK66XZVF3K=JV2ABGJ7TWYEJBW4CEPSXKKV

Hope this helps!

8 Likes

Thanks a bunch, Kevin. I really appreciate your help.

Rufus

that is great. just the answer I was looking for!
Thanks you Kevin!