Show a base64 PDF from API in preview

Hi all!

I just started in Weweb and I would like to build a customer packaging approval portal.
The idea is to get all the data directly from the ERP system and send it back with approvals.

I would like to drop and drag PDF in to the app. The PDF will be send to the ERP through an API in base64. This works fine.

However when I would like to see the PDF in Weweb I run into a problem. I get the data from the ERP in a base64 string. I cannot find a way to show this in the PDF viewer.

  • I tried to bind the base64 to the pdf viewer, this did not work.
  • I tried to use the “create URL from base64” which works except creates a file without an file extension. When I try to bind it to the PDF viewer, it will download the file and not show it.

Does anyone know how to fix this?
Kind regards,
Pieter

Hi @heestp :wave:

Just wanted to let you know we haven’t forgotten about you. The tech team is looking into this because we’re not sure if this is a bug, or a limitation of our base64 actions or a limitation of our PDF viewer element.

We’ll keep you posted!

Hi Joyce,

Thanks for the update. I think it is in the base64 because I want to do it the other way around too.

I want to upload a file through weweb (upload file) and encode it to base64, then pass it through via an API. However PNG or JPG works but not for PDF.

I have been trying to figure this out all day and finally got it to work like this:

Let me know if it works for you! :slight_smile:

1 Like

Hi, it’s your binding to send or to view the pdf ?

Because if you use our encode file as base64 and select dataurl this is what you should get (a string formatted like this, starting with data:…)