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
kisore pockisore poc 

display attachment

hi , 
 how to display images and pdf in a lightning component from attachemnts,. where img src tag dosent allow pdf it supports only images
Khan AnasKhan Anas (Salesforce Developers) 
Hi Kisore,

I trust you are doing very well.

You cannot show a pdf through HTML IMG tag. Instead, you should use either a javascript pdf viewer like the PDF.JS, or maybe you can render the pdf as its own page inside an iframe.

Please refer to the below link which might help you further with the above issue.

https://salesforce.stackexchange.com/questions/189451/lightning-component-pdf-viewer-iframe

https://salesforce.stackexchange.com/questions/188857/show-an-attachment-image-inside-a-lightning-component

https://github.com/kumarrk21/PDFViewer

https://medium.com/my-journey-with-salesforce1-platform/pdf-viewer-lightning-component-f96e6a5704ab


I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks and Regards,
Khan Anas