PSPDFKit for Salesforce enables you to open PDF, JPG, PNG, and TIFF files inside Salesforce. This unlocks the full functionality of PSPDFKit in Salesforce, including PDF generation, redaction, and signatures.
This README explains how to integrate PSPDFKit into a new Salesforce project. The integration works as a Lightning web component (LWC) that you can add to any Salesforce organization.
For more information on integrating PSPDFKit into an existing Salesforce project, see the PSPDFKit for Salesforce documentation.
PSPDFKit for Salesforce shares the same APIs as PSPDFKit for Web Standalone. For more information on customizing your Salesforce application, see the PSPDFKit for Web Standalone documentation.
Before continuing, perform all of the following actions:
- Set up a Salesforce Developer Edition account.
- Install the Salesforce CLI.
- Install the latest stable version of Node.js.
- Install a package manager compatible with npm. This README contains usage examples for the npm client, which is installed with Node.js by default.
To deploy the PSPDFKit package to your Salesforce organization, follow these steps.
-
Download the PSPDFKit for Salesforce project from GitHub, and then unpack the ZIP file.
Alternatively, run the following terminal command to clone the PSPDFKit for Salesforce repository from GitHub:
git clone https://github.com/PSPDFKit/salesforce.git
-
In the terminal, go to the PSPDFKit for Salesforce project folder and run the following command to install the PSPDFKit npm module.
Use the following code for npm:
npm install
Use the following code for Yarn:
yarn install
-
The PSPDFKit for Salesforce integration example now makes use of the PSPDFKit version available from our CDN at https://cdn.cloud.pspdfkit.com/pspdfkit-web, which means it's no longer limited by Salesforce's upload assets size 5MB limit.
In order to set the PSPDFKit version you want to use, open ./force-app/main/default/pages/PSPDFKit_InitPSPDFKit.page
and edit the line 7 to reflect the PSPDFKit version. For example, in order to use version 2024.4.0, you should change the URL pointing to the CDN to:
```html
<script src="https://cdn.cloud.pspdfkit.com/[email protected]/pspdfkit.js" type="text/javascript"></script>
```
You can find the latest version of PSPDFKit for Web in the [PSPDFKit changelog](https://pspdfkit.com/changelog/web/).
-
Run the following command in the terminal to start the Salesforce authentication process:
sfdx force:auth:web:login --setalias mySalesforceOrg --instanceurl https://login.salesforce.com --setdefaultusername
-
In the browser window that opens, log in to your Salesforce organization and authorize the Salesforce CLI.
-
In the terminal, run the following command from the PSPDFKit for Salesforce project’s root folder:
sfdx force:source:deploy -x manifest/package.xml
To enable users of your Salesforce organization to use PSPDFKit, follow these steps.
-
In Salesforce, go to Users > Permission Sets.
-
Find PSPDFKit Admin Access in the list and click it.
-
Click Manage Assignments.
-
Click Add Assignment.
-
Select the users you want to authorize to use PSPDFKit.
-
Click Next, and then click Assign.
PSPDFKit for Salesforce requires Lightning Locker to protect Lightning web components, but Salesforce uses Lightning Web Security by default. To change the default security settings, follow these steps.
-
In Salesforce, go to Security > Session Settings.
-
Deselect Use Lightning Web Security for Lightning web components.
-
Scroll down and click Save.
To use PSPDFKit in your Salesforce organization, follow these steps.
-
Ensure you’re logged in as a user authorized to use PSPDFKit.
-
In the top-right corner, open the App Launcher.
-
Search for and select PSPDFKit.
-
Click browse to upload local PDF files, or open a file from Salesforce.