Skip to content

Commit

Permalink
update READme
Browse files Browse the repository at this point in the history
  • Loading branch information
annyhe committed Jun 21, 2019
1 parent 3c924c8 commit 9f5b390
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
These are two Lightning Web Components to add PDF viewing capabilities to your Salesforce page. Configure which PDF file via the Lightning App Builder. Light up your org with PDF for training, enablement, entertainment ... The possibilities are endless!

Use the **showPdfById** for Home and App pages.
![PDF Viewer on Opportunity Record page](recordPage.png)
![PDF Viewer on Home page](homePage.png)

Use the **showPdfRelatedToRecordId** component for Record pages.
![PDF Viewer on Home page](homePage.png)
![PDF Viewer on Opportunity Record page](recordPage.png)

> These components are designed to run on Salesforce Platform. If you want to experience Lightning Web Components on any platform, please visit https://lwc.dev, and try out our Lightning Web Components sample application [LWC Recipes OSS](https://github.com/trailheadapps/lwc-recipes-oss).
Expand Down Expand Up @@ -51,29 +51,29 @@ sfdx force:org:open
```

### Pre-requisite
Before any coding, we need to set the expected behavior of opening a PDF file in **Setup**, otherwise we might accidentally download the file instead of viewing it. Go to **Setup → Security → File Upload and Download Security**, find the **.pdf** label, click the **Edit** button, and set the picklist value of the pdf to **Execute In Browser.**
Before any coding, we need to set the expected behavior of opening a PDF file in **Setup**, otherwise we might accidentally download the file instead of view it. Go to **Setup → Security → File Upload and Download Security**, find the **.pdf** label, click the **Edit** button, and set the picklist value of the pdf to **Execute In Browser.**

All set? Let's add the components to the respecitive pages!
All set? Let's add the components to the respective pages!

### Directions to add a PDF viewer component to an App or Home page

1. Go to an App or Home page. Click on the **Setup** icon on the top left, then click **Edit Page**.

2. Drag the **showPdfById** component onto the page.

3. In the Lightning App Builder, set youTubeId field to the desired PDF File's Content Document ID. Where do you find this? Go to File --> Desired File --> Download, then get the ID in the browser. The url format should be like this HOST/sfc/servlet.shepherd/document/download/FILE_ID
3. In the **Lightning App Builder**, set **youTubeId** field to the desired PDF File's Content Document ID. Where do you find such an ID? Go to **File --> Desired File --> Download**, then get the ID in the browser. The url format should be like this *HOST/sfc/servlet.shepherd/document/download/FILE_ID*

![Set the PDF File ID in App Builder](homePageConfig.png)

4. Click **Save**, then **Back**.

5. Enjoy your PDF viewer on the App or Home page!
5. Enjoy your PDF on the App or Home page!

![PDF Viewer on Home page](homePage.png)

### Directions to add a PDF viewer component to a Record page

1. Go to a Record page. Make sure there is at least one PDF File related to the Record. If there are no related PDF File(s), the component will show an error message.
1. Go to a Record page. Make sure there is at least one File of type PDF related to the Record. If there are no related PDF File(s), the component will show an error message.

2. To add the component to the Record page, click on the **Setup** icon on the top left, then click **Edit Page**.

Expand Down

0 comments on commit 9f5b390

Please sign in to comment.