PDF Reader blank

I feel like I am missing something obvious. I can’t get the PDF Reader to work. My app consist of a button with an action to upload a file and a PDF Reader UI component. The PDF isn’t displayed in the app. I’ve confirmed the PDFs to work with the showroom app and I can also download them in my own app.

Both the showroom app and my own app crashes with the error “Cannot read properties of null (reading ‘sendWithPromise’)” if I try to upload a PDF if a file object already exists.

image

image

image

Hi!

We have a challenge registered on this one I believe.

This happens when the PDF component is loaded with one file, and then the source of the pdf is changed an additional time.

As a work around, attempt to only load the pdf component when you know the content of the pdf is available. In other words, you may manipulate the visibility of the PDF reader with an app variable, and reset the variable it before reading in the content.

Does this relate to the PDF reader being blank or only the error? I can’t get the PDF to show up on the screen with visibility conditions either.

Aha, so is you delete that runtime datasource just before the create pdf, does it work?

What I referred to is a timing issue, occuring when the pdf-reader aldready displays a pdf, while that same datasource is replaced with a new file. In that case, you need to hide the pdf reader, then create the pdf, then show the pdf reader.

That seems to prevent the crash, yes.

Still can’t display a PDF though. I made an empty app with only the PDF reader and two buttons to double check and I can’t figure out why the PDF is not displayed.

Bumping this.

image

It’s not crashing anymore, but I don’t see any PDF. I tried displaying a resource file as well, but nothing shows up.

Hi!

There is no bug in our similar setup. It is hard to give you a good answer to what the issue is, other than a few other things you may try.

  1. If you create a download file action, will the PDF download and display correctly in adobe etc?
  2. If so, can you try to set a fixed width and/or heigth of the PDF viewer UI Component?

Setting a fixed width or applying stretch in flex-child will make the PDF show up it seems.

Edit: If this is intended I hope you can update the documentation.

Great! Docs updated with a little warning/disclaimer on this for now.

1 Like