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

1 Like

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:

2 Likes

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:…)

Hi !
I have the same trouble. In my case, I need to display an invoice from another system.

  1. I have a form where I put the invoice number

  2. When I submit I have a create URL from Base64 :

  3. Then I update a variable with the generated url

In the end, it download the file, not display.

I tried to escape the “blob:” but I have this :

Any idea of how I can sort this out ? :slight_smile:

Works for me ! :slight_smile:

Hi!

Thanks for the share.

I have it working, I am quite strugling with the PDF name. I tried to add “/filename.pdf” to the actual url but it does not work in all cases.

Do happen to have a workeround on this one ?