The PDF Butler Pre-Viewer lets users generate a PDF from a Salesforce record and review it on the page. Add Pack buttons beneath the preview when users need to email, send for signing, or process the document after reviewing it.
What you’ll need
- PDF Butler installed in Salesforce.
- A DocConfig that generates the document you want to preview.
- Access to edit and activate the Lightning record page.
- The required Packs, if you want action buttons beneath the preview.
Follow Steps 01–02 to add and test the Previewer. The remaining sections cover saving behavior, the PDF toolbar, and troubleshooting a blank preview.
Step 01: Add the Previewer to a Record Page #
1. Open a Salesforce record. From the Setup menu, choose Edit Page.
2. In Lightning App Builder, find LC_PreviewComponent under Custom – Managed and drag it onto the page.
3. Select the component to open its properties.

4. Open the DocConfig you want users to preview. Copy its Salesforce record ID from the URL.

Use a DocConfig that generates the intended document for the type of record on this page.
5. Return to the Previewer’s properties and paste the ID into DocConfig to retrieve.

6. If users need action buttons beneath the preview, open the required Pack and copy its Salesforce record ID.
7. Enter the ID in Packs to retrieve. Separate multiple Pack IDs with commas.

The Packs you select provide the buttons beneath the preview, such as email or signing actions.
Step 02: Finish the Setup and Test the Preview #
8. If your DocConfig uses a locale or an Alternative, configure the corresponding component properties.
- Locale required? controls whether a locale is required. Use the accompanying field property if the locale comes from a Salesforce record field.
- Alternatives enabled? enables Alternatives for the document. Use the accompanying field property if the Alternative comes from a Salesforce record field.

9. Click Save in Lightning App Builder. Activate the page if needed.
10. Return to the record and refresh the page. Click PDF in PDF Butler Document Previewer.
11. Check that the generated document contains the expected record data.

12. If you configured Packs, review the PDF and click the required action button beneath it. Check the result of that action.

13. Click Close when you have finished reviewing the preview.
Watch how to add the Previewer, select a DocConfig, and configure Pack actions. The video starts at the page setup.
Step 03: Choose When Documents Are Saved #
14. Open the DocConfig and check its Delivery option.

A delivery option such as FILES saves generated documents to Salesforce. Without an override, previewing can create a file even before the user runs a Pack.
15. Open the record page in Lightning App Builder and select LC_PreviewComponent.
16. Find deliverytype Overwrite. Choose the saving behavior using the table below.

| Option | Behavior |
|---|---|
| NONE | Uses the DocConfig’s configured delivery option. |
| BASE64 | Returns the document for preview without saving it through the Previewer’s delivery setting. |
| VIEW_THEN_SAVE | Previews without saving, then saves when a Pack is run. |
17. For a workflow that saves the document when a Pack is run, select VIEW_THEN_SAVE. Click Save.

18. Refresh the record page and generate a preview. Check the record’s files to see whether previewing saved a document.
19. If you chose VIEW_THEN_SAVE, run a configured Pack and check the record’s files again.

Watch how the delivery overrides affect file storage when users preview a document or run a Pack.
Step 04: Enable the Previewer Toolbar #
20. In Lightning App Builder, select the Previewer and find Show toolbar in previewer.
21. Select Show toolbar in previewer and click Save.

22. Return to the record, refresh the page, and generate the PDF again.
23. Check that the toolbar appears at the top of the viewer. Test the zoom, download, and print controls.

The toolbar controls the PDF viewer. Pack buttons beneath the document run the actions configured in PDF Butler.
Watch where to enable the toolbar and how its controls appear in the PDF preview.
Step 05: Resolve a Blank Preview #
24. If the preview opens as a white panel, confirm that the DocConfig can generate the document outside the Previewer.

If document generation works but the preview stays blank, Salesforce clickjack protection may be blocking the embedded viewer. The steps below address that cause.
25. In Salesforce Setup, search for Session Settings and open it.
26. Locate the Visualforce clickjack settings and the trusted-domain section. Keep the applicable clickjack protection enabled.

Salesforce’s Specify Trusted Domains for Inline Frames guide explains the domain settings. The tutorial uses the older label Whitelisted Domains for Visualforce Inline Frames.
27. Under Trusted Domains for Inline Frames, click Add Domain.
28. Enter the Lightning domain from your org’s record-page URL. Leave out the record path and any extra spaces.
29. If Salesforce asks for IFrame Type, select Visualforce Pages. Save the domain entry.

Use the domain for your own Salesforce environment, including the sandbox domain when applicable. Do not copy the domain shown in the tutorial.
30. Save the Session Settings changes, return to the record, and refresh the page.
31. Open the PDF again. Confirm that it displays while clickjack protection remains enabled.

Watch the domain setup used to display the Previewer while keeping clickjack protection enabled. The video starts at Session Settings.