function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Guntin Guntin L GarciaGuntin Guntin L Garcia 

Download and render files (image or pdf) in an LWC component.

Requirement:
Renderer files (image or pdf) in an LWC component.
I have access to Dropbox API, I need to download a file and show it in an LWC.
I'm using the fetch function to retrieve the file but I don't know how to render it in an LWC component.

I appreciate any help.

Thanks


 
AnudeepAnudeep (Salesforce Developers) 
Hi Guntin, 

I recommend checking Display PDF Files with Lightning Web Components for the sample code

Let me know if this helps, if it does, please mark this answer as best so that others facing the same issue will find this information useful. Thank you
Guntin Guntin L GarciaGuntin Guntin L Garcia
Thanks, Anudeep,

I've already read that article. In my scenario, the file is downloaded to the browser through the Fetch function. I have the Blob object. How could I render a Blob in an LWC?
Thanks
Akash KaluseAkash Kaluse
Hi Guntin,

I have similar kind of requirement where I am getting binary data of pdf file from REST API. And on click of button in LWC I want to download the pdf file. Could you please share the solution if you got any?

Thanks