AVAILABLE NOW: Spring 2025 Release

Using Secure Redaction in Salesforce with WebViewer

By Isaac Maw | 2025 May 28

Sanity Image
Read time

5 min

For teams that work directly in Salesforce, switching between platforms to work with documents can slow down productivity and lead to versioning issues. Apryse’s WebViewer library for Salesforce enables developers to embed robust document viewing, editing, and more in a lightning web component.

In this article, let’s go over how to apply secure redactions to documents in Salesforce with WebViewer. Whether you use WebViewer in Salesforce today or are considering the benefits, here’s just one example of the document processing features this integration brings to the leading CRM.

Try the WebViewer in Salesforce Demo 

Secure PDF Redaction

Copied to clipboard

Document redaction may seem simple, but it takes more than a black box over text to ensure the data is irretrievably hidden. In legal documents or for privacy compliance, failing to securely redact data and accidentally revealing it can have significant consequences.

Apryse enables secure, permanent deletion of sensitive data from PDFs, images, Microsoft Office files, and more, so users can handle documents of any type and complexity without compromising sensitive information.

Secure redaction is essential in:

  • Legal Compliance: Achieve legal compliance by permanently redacting confidential information before disclosure.
  • Healthcare Privacy: Safeguard patient privacy and align with regulatory standards like HIPAA by securely deleting personal health information.
  • Financial Security: Protect sensitive financial information from unauthorized access through thorough document redaction.

Check out the WebViewer redaction demo in our showcase here. 

Getting Started with WebViewer in Salesforce

Copied to clipboard

WebViewer is a pure client-side JavaScript library to annotate, view, and edit documents. The Salesforce-specific build of WebViewer can be easily integrated into your application as a Lightning Web Component and is optimized for Salesforce's 5MB static resource file size limit.

To start a free trial, download WebViewer source files here or watch this video tutorial for deploying WebViewer to Salesforce using a Low Code method.

File Type Support

  • PDF, PDF/A
  • DOCX, XLSX, PPTX (MS Office software or licenses are not required)
  • JPG, PNG
  • XOD (requires removal of PDF and Office folders from the package)

How to Redact Documents in Salesforce

Copied to clipboard

This guide will help you utilize all of Apryse's Redaction capabilities in Webviewer alongside Salesforce Lightning Components.

WebViewer configuration required for redaction

In your LWC where you initialize WebViewer (you can check out pdftronWvInstance.js in our sample repository). This shows you how to enable redaction:

//snipped for brevity
const viewerElement = this.template.querySelector('div');

const viewer = new PDFTron.WebViewer({
    path: libUrl,
    custom: JSON.stringify(myObj),
    config: myfilesUrl + '/config_apex.js',
    fullAPI: true // this must be set to true
    enableRedaction: true, // this must be set to true
    // l: 'YOUR_LICENSE_KEY_HERE',
}, viewerElement);

Note: You need to use the pdf_full.zip file in your /staticresources/ folder to access full API, which is required for redaction.

Search and redact

You can use search to highlight single or all occurences of a search term. You may also use regular expressions, which allows to target e-mail addresses, phone numbers, credit card numbers, etc. See more in our searching documents guide.

When performing your search, add a searchListener that marks your search results for redaction like so:

const searchListener = (searchTerm, options, results) => {
    // add redaction annotation for each search result
    const newAnnotations = results.map(result => {
        const annotation = new Annotations.RedactionAnnotation();
        annotation.PageNumber = result.pageNum;
        annotation.Quads = result.quads.map(quad => quad.getPoints());
        annotation.StrokeColor = new Annotations.Color(136, 39, 31);
        return annotation;
    });

    annotManager.addAnnotations(newAnnotations);
    annotManager.drawAnnotationsFromList(newAnnotations);
};

instance.addSearchListener(searchListener);

You can also create redactions programmatically. Check out our documentation for a guide.

Next Steps

Copied to clipboard

You can review the Salesforce PDF App to showcase an end-to-end example of search, and how you can leverage it for redaction and content replacing on our Github repository. For more information, contact sales or reach out to us on Discord.

Sanity Image

Isaac Maw

Technical Content Creator

Share this post

email
linkedIn
twitter