For a while now, we've enjoyed working with partners worldwide inventing cool, new solutions on top of Salesforce tailored to particular industries. And one commonly asked-for feature by these clients was an easier way to generate personalized quotes, proposals, contracts, invoices, and other business documents using Salesforce data.

We knew this was an important feature for customers to optimize their document management processes, so we created an automated document generator native to Salesforce. By building templates in Office formats like docx, pptx, and xlsx, users can control template creation without relying on developer resources. The solution also integrates directly as a Lightning Web Component with processing performed right in the browser -- no connectors, plugins, MS Office licenses or MS Office software required.

In this post, we discuss typical methods of document generation in Salesforce and how we developed a simple, scalable, automated solution that generates beautiful results in just a few clicks.

You can check out PDFTron’s web-based document generation demo to see these feature in action in your browser. Or watch our recent webinar to learn more about PDFTron's Salesforce native capabilities.

Typical Methods of Document Generation in Salesforce

Today, options on the AppExchange and a few external to Salesforce offer developers, architects, administrators and consultants ways to generate documents from templates -- each with its pros and cons.

For example, solutions that require data to leave Salesforce typically offer more functionality but introduce external dependencies and API calls, impacting a solution’s reliability, security, performance, and scalability across a large user base. Additionally, such solutions often require users to complete additional steps to generate documents or to exit the application, thus creating complexity in the workflow and also, a less-than-optimal user experience.

Conversely, solutions that construct templates with web code (HTML with CSS stylings) can simplify elements of security and integration. But they then exclude non-code-savvy business users from direct participation in template creation and maintenance. As a result, companies often take on this burden, hiring a developer just to create and maintain templates rather than using the existing ones that users create with familiar desktop or free cloud-based document editing applications such as Google Documents.

Automating Document Generation with PDFTron’s SDK

PDFTron’s document generation technology introduces a simple, scalable framework for automating document generation right in Salesforce.

You can provide a template as an Office document and Salesforce data from any data source. And PDFTron handles the rest, with features in a single UI designed to streamline the entire doc gen workflow, from template creation, to field mappings, to dynamic previews of documents populated with Salesforce page data.

Furthermore, built with pure JavaScript and optimized for the Salesforce environment, PDFTron’s solution integrates directly to look and feel like part of your application.

Benefits of using PDFTron’s Document Generation for Salesforce:

  • Works from Familiar Office Format Templates (docx, pptx, xlsx)
  • Intelligent Detection of Template Fields and Data Mapping Features
  • Responsive, Dynamic Previews
  • Rich Additional Functionality: Annotations, Signatures, Redaction, etc.

Use Existing Templates from Word, Excel and PowerPoint

PDFTron’s technology comes with its own Office rendering engine built-in without requiring any MS Office software or MS Office licenses. What this means is that, like with “mail merge”, it can create invoices, phone bills, and pretty much anything else from standard formats such as PPTX, XLSX, and DOCX. (It will also work with JSON and XML files programmatically.)

End users can thus build their own templates using familiar desktop and free cloud-based document editing software, while at the same time, developers are spared from having to “reinvent the wheel”.

Documents are generated from Office file templates populated intelligently with Salesforce page data

Automated Template Field Detection and Data Mapping

Next, our offering can intelligently detect all the fields in uploaded templates, without having to type them out, thereby reducing typos and erroneous data mappings.

We are currently creating a connector with drag-and-drop template components. This will let users map their fields to Salesforce page objects without writing any lines of code.

Alternatively, you can write this logic yourself, tailoring it specifically to your users for a better experience, instead of having to rely on a fully built component and then facing support delays and possibly, the features you want never being implemented.

Responsive, Dynamic Previews

The UI also comes with built-in viewer features to provide responsive previews of generated documents. The engine dynamically reflows content such as tables to fit new data. And it supports inserting of images, such as a company logo, with responsive wrap-around of text. It’s also fast enough that all this occurs in real time from the user’s perspective, empowering them to make quick adjustments on the fly before hitting “send”, confident that documents will appear just as expected to recipients.

Rich Additional Functionality

PDFTron’s Salesforce Document Editing Solution supports a complete array of other document editing tools and capabilities, such as annotations, signatures, and redaction. Along with the solution’s open-source UI, this means you’re free to customize the behavior, appearance, and functionality of the viewer as much as you like.

For example, developers could rapidly assemble professional solutions in support of remote negotiations, reviews, authorizations, etc. And with PDFTron’s high-performance rendering, users can view a complete variety of documents, including detailed contracts with very fine print, NDAs, proposals, architectural drawings, and more.

Next Steps

As an official Salesforce partner, we are committed to helping Salesforce developers bring best-in-class document experiences to all their users.

If you’re curious about our technology, and want to know more about how it can help you reduce costs and shorten timelines, improve security, and enhance scalability -- don’t hesitate to contact us.

For more information, be sure to check out our get-started guide for using PDFTron in Salesforce. Or watch our Webinar on integrating PDFTron’s viewing and editing as a Lightning Web Component.