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
Jeevana Priyanka BJeevana Priyanka B 

How to open a PDF file in lightning.

I have PDF File and i want that PDF file to be shown on every record and must be able to edit.

for example: Assume i have custom button related to evrey custom object record when rep clicks on that button it should open that pdf page and user must be able to save and edit the pdf file related to that record how can achieve this in salesforce Lightning.

I am new to custom developing. any help is greatly appreciated.

Thank you!

Ajay K DubediAjay K Dubedi
Hi Jeevana,

There are two methods to show a PDF in Lightning Component.
1. First, you can create a Visualforce page and embed it in the Lightning component. 
    See detailed example:http://www.vermanshul.com/2017/07/lightning-generate-pdf-from-lightning.html
2. Second is the usage of PDF.JS library to directly use the lightning component to display the PDF. 
    See details here:https://medium.com/my-journey-with-salesforce1-platform/pdf-viewer-lightning-component-f96e6a5704ab
    Entire source code can be found here:https://github.com/kumarrk21/PDFViewer
    
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks,
Ajay Dubedi
Jeevana Priyanka BJeevana Priyanka B

Hello Ajay,

Thank you so much for the response, But i dont want to generate a pdf in salesforce i have an external PDF file which needs to shown related to every record (new/existing) for a specific custom object and need the ability to save and edit the file for the record owner. 

Thank you!