I have a PDF stored in Document Folder.

I want to display this PDF in my lightning component.

How should I do this?

2 Answers 2


Since <embed> doesn't work in lightning component, I think currently the only way of doing it is embed a VF page inside the lightning component and put the embed tag in the VF page:

<embed src="/resource/your_file_name" width="800px" height="2100px"/>

Adjust it with your width and height.


You can create iframe and put path to your document in scr attribute. Also you can call function onload in iframe to perform some additional logic.

And if you want to display PDF stored in Document Folder it can be done in the next way: /servlet/servlet.FileDownload?file={documentId}


<iframe src="/servlet/servlet.FileDownload?file={documentId}"></iframe>

If you create VF page you still need create an iframe and put in src path to you page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.