Book Demo
  • Industries
    • Healthcare
    • Finance
    • Legal
    • Non-Profit
    • Education
    • Technology
    • E-Commerce
  • Product
    • Titan Forms
    • Titan Docs
    • Titan CLM
    • Titan Sign
    • Titan Web
    • Titan Survey
    • Titan Flow
  • Pricing
    • Titan Products
    • Titan Add-ons
  • Learn
    • Blog
    • Knowledge Base
    • Titan Academy
    • Webinars
    • Integrations
    • Compliance
    • Templates
  • Connect
    • Customer Success
    • Support
  • Company
    • About Us
    • Contact Us
    • Partners
    • Careers
  • Sign In
  • Sign Up
MENU
  • Solutions
        • Titan Extends Salesforce Health Cloud

          family walking towards healthcare worker
          Connect doctors, nurses, and patients for holistic and personalized healthcare solutions
        • By Product

          • Titan Forms
          • Titan Docs
          • Titan Sign
          • Titan CLM
          • Titan Survey
          • Titan Web
          • Titan Flow
        • By Industry

          • Healthcare
          • Finance
          • Legal
          • Nonprofit
          • Education
          • Technology
          • eCommerce
          • Insurance
        • All Industries
        • By Use Case

          • Web-to-lead
          • Fillable PDF
          • Experience Cloud
          • Feedback Form
          • Dynamic Forms
          • Websites
          • Dynamic Portals
  • Pricing
    • Titan Products
    • Titan Add-ons
  • Resource Center
        • Healthcare Solutions for Salesforce

          family walking towards healthcare worker
          Learn what Titan has to offer for the Healthcare Industry
        • Learn

          Blog

          Discover the latest Titan product and company news

          Knowledge Base

          Get lots of tips and advices to get the most from Titan

          Titan Academy

          Sign up for interactive courses to learn Titan

          Webinars

          Watch Titan Previous Webinars

          Integrations

          Learn all about Titan's Integrations

          Compliance

          Learn all about Titan's Certifications

          Templates

          Hit the ground running with ready-to-go online templates

        • Connect

          Customer Success

          Read all about Customer Success Stories

          Support

          Need Help? Enter Titan's Documentation Center

          Professional Services

          Let Titan experts help you take the project to a new level

          Titan X Lab

          Have a feature request? This is the right place to post and vote for other ideas

  • Company
    • About Us
    • Contact Us
    • Professional Services
    • Partners
    • Careers
  • Sign In
  • Sign Up
Book Demo
spiner
By submitting your email you agree to our terms and conditions

Generate a PDF in Salesforce

5 min read
Salesforce Scribe
Emily Anderson

Experienced wordsmith, with a keen eye for best of breed Salesforce experiences.

Updated: Sep 27th, 2023

Many organizations choose to generate their documents as PDFs in Salesforce so that all their content across all teams is standardized and looks professional. Documents that are great candidates for PDFs include quotes, invoices, sales proposals, and even data reports.

Choosing to use Salesforce to generate PDFs will keep all your document data accurate and all your files consistent with regards to appearance, layout, and themes.

PDF Generation
PDF Generation

Salesforce: Generate PDF in 3 Ways

There are many ways to generate a PDF out of Salesforce, but the exact method that you choose will heavily rely on your Salesforce setup, your integration tools, and your specific use case requirements. To get you started, we found three approaches to explain how to export a PDF from Salesforce.

Visualforce Pages

Salesforce provides a framework called Visualforce that can help you create user interfaces. Take your Visualforce pages to the next level and use the “renderAs” attribute to generate the page as a PDF.

Lightning Components

Salesforce lets you use Lightning components and the lightning:container component to generate PDFs. How it works is that the lightning:container component allows you to write code for rendering PDFs outside of a Lightning component framework. In order to use this approach, you must add an external library that supports generating PDFs.

This approach is more flexible than Visualforce but requires more coding knowledge to implement successfully.

Apex

Your third approach could be to use the Apex programming language to generate PDFs. Many administrators use third-party libraries in their Apex code to assist with generating PDFs. Some useful third-party libraries include PDFBox or Flying Saucer.

Using Apex code to generate PDFs gives your business teams more customization options as they can control the structure and content of a generated PDF.

Customization Options
Customization Options

JavaScript PDF Generator for Salesforce

For your convenience we have provided two examples of JavaScript libraries that you can use to generate PDFs from Salesforce.

LibraryDescriptionCode Example
jsPDF LibraryYou can use this popular JavaScript library to create PDF documents dynamically in Salesforce by adding it to your Lightning Component’s static resources. Then, use the basic jsPDF code on the right to generate a PDF within a Salesforce Lightning Component.// Lightning Component Controller

({

generatePDF: function(component, event, helper) {

var pdf = new jsPDF();pdf.text(20, 20, “Hi, let’s generate a Salesforce PDF with jsPDF!’); 

var pdfOutput = pdf.output();var pdfBlob = new Blob([pdfOutput], { type: ‘applictaion/pdf’ });

var pdfURL = URL.createObjectURL(pdfBlob); 

// Use pdfURL to display or download the PDF 

component.set(“v.pdfURL“, pdfURL);
}
})
Visualforce PageYou can generate PDFs in Salesforce on Visualforce pages with the renderAs attribute. This is a simple option, and you don’t need to write any direct JavaScript code to get it to work. Use the basic code provided in the column on the right to get Salesforce to render the content of a Visualforce page as a PDF. When you test your code, notice that the content within the apex:page tag generates a PDF.htmlCopy code<apex:page renderAs=”pdf”>
<h1>Create a PDF from my page!</h1>
<p>My PDF generated from a Visualforce page.</p>
</apex:page>

How to Generate a PDF Link in Salesforce

There are two common ways that you can generate a PDF link in Salesforce. The first method is by using Visualforce pages, and the second is to use Lightning Components. We will discuss both approaches in this article. Let us know which dynamic PDF generator suits your requirements better.

Visualforce Pages to Generate PDF Link

We already discussed how you could use Visualforce to create custom user interfaces and generate PDFs from contents on a page, but you can also use this framework to generate a PDF and a link to that page. To replicate this example on your side, follow the steps below:

1. Use the following code to generate a PDF. The renderAs attribute will get Salesforce to display the content of your page as a PDF. Keep in mind that the content inside the tag can be replaced with the content you want:

<apex:page renderAs=”pdf”>
<h1>Your PDF Content Goes Here</h1>
<p>This is an example PDF generated using Visualforce.</p>
</apex:page>

2. The next step would be to generate a link to the Visualforce page, which can be implemented with the code below. You can also replace “YourVisualforcePageName“ with the name of your Visualforce page.

<a href=”{!URLFOR($Page.YourVisualforcePageName)}” target=”_blank”>Generate my PDF</a>

Lightning Components to Generate PDF Link

If you are looking for a flexible approach to generating a PDF link, then you want to use Lightning components in Salesforce. Follow the steps below to generate a PDF link using Lightning components:

1. Create a Lightning component that generates a PDF with the code below:

({

generatePDF : function(component, event, helper) {

window.p[er(‘/apex/YourVisualforcePageName’, ‘_blank’);

}

})

2. The “generatePDF“ function will generate your content, and will open the PDF in a new window with the “window.open“ method.
3. Remember to replace “YourVisualforcePageName” with your Visualforce page name.
4. Add the Lightning component to your Lightning app or page.

Export PDF Tool Options for Salesforce

As you can see from our article, to generate a PDF report from Salesforce requires some coding and technical knowledge. If you are looking for a third-party application to assist you with exporting PDFs from Salesforce, then we recommend checking out the Salesforce AppExchange.

Third-party Applications
Third-party Applications

For starters, you can find Titan for dynamic PDF generation on the Salesforce AppExchange. With Titan’s Word Add-in, you can preview and download your interactive documents in a PDF after configuring your templates with data from Salesforce. If you would like to learn more about this topic, read our Word Add-in – Preview PDF article in our support center.

For an objective view, we have also selected four reliable third-party tools that integrate with Salesforce for PDF exports.

Conga Composer

With Conga Composer, your teams can automate their processes to create and generate PDFs with Salesforce data. Many companies trust Conga Composer to generate PDFs from Salesforce for their contracts, quotes, and proposals.

DocuSign

DocuSign is more than just a third-party Salesforce PDF generation tool. When you choose to integrate DocuSign with Salesforce, your staff can add and manage e-signatures in their PDF documents. Organizations that regularly work with records that need to be signed and shared choose to use DocuSign.

WebMerge

This third-party tool for Salesforce can populate templates with data from your CRM platform so that you can also generate a PDF for export. Many organizations choose WebMerge to help generate invoices, contracts, and reports as PDFs.

Drawloop

Previously known as Nintex Document Generation, Drawloop works well with Salesforce. Your teams can use Drawloop to create PDFs with data pulled from your Salesforce records.

PDF Creation
PDF Creation

FAQ

Are you looking for more content? Here are a few more questions we pulled from our Titan archives regarding PDFs and Salesforce.

How do I create a PDF using Apex in Salesforce?

First, use the PageReference. getContentAsPDF() Apex method. This method will render your Visualforce page as PDF data. Now, use Apex code to convert your PDF data to a document, such as PDF.

Can Salesforce generate documents?

Yes, Salesforce can generate the documents you have in your CRM platform. Keep in mind that the types of documents you can generate depend on your unique integrations.

Can you upload a PDF to Salesforce?

Yip! Salesforce supports all file types, such as PDF files, PowerPoint presentations, Excel spreadsheets, image files, and more.

Create, Generate, and Share Professional Documents

Thank you for reading our article. We hope you found it engaging and that you were able to follow along with the guides to export a PDF. If you want to create flexible Salesforce documents, look no further than Titan.

Titan is a no-code digital experiences platform with many features to help make the most of your Salesforce account, including document generation. Titan offers static and dynamically generated documents with a simple button click. Let your staff create documents with multiple specific details and records pulled directly from Salesforce. You also get the option to download your attached documents or attach them to records in Salesforce!

Sound interesting?

Contact us today!

  • Twitter
  • Facebook
  • YouTube
  • LinkedIn
Salesforce AppExchange
Titan Website

Disclaimer: The comparisons listed in this article are based on information provided by the companies online and online reviews from users. If you found a mistake, please contact us.

You might be interested in these articles too

Salesforce Document Generation for Reports and Dashboards

Salesforce Document Generation for Reports and Dashboards

5 min read
Compliance Documentation Generated with Salesforce

Compliance Documentation Generated with Salesforce

5 min read
Salesforce Document Generation for Letters and Correspondence

Salesforce Document Generation for Letters and Correspondence

4 min read

Do you like these Titan solutions for Document Generation?

Discover Salesforce document generation solutions by scheduling a demo with Titan today!

spiner
By submitting your email you agree to our terms and conditions

Related

  • Salesforce Document Generation for Certificates and Licenses
  • Salesforce Document Generation for Onboarding and Training Materials
  • Salesforce Document Generation for Marketing Collateral
Book Demo
TITAN logo

A powerful, Patents Pending, zero code platform for salesforce forms, documents generation, web applications, Surveys flows and more. HIPAA, GDPR and other compliances are supported as well.

© 2015-2023 Titan | Multiple Patents Pending

Solutions

  • Titan Docs
  • Titan Sign
  • Titan Forms
  • Titan Survey
  • Titan Web
  • Titan Flow

Platform

  • Sign In
  • Sign Up
  • Pricing
  • About Us
  • Terms of Use
  • Compliance
  • Privacy Policy
  • Cookie Policy

Support

  • Contact Us
  • Request Demo
  • Help Center
  • Titan Academy
  • Salesforce AppExchange
  • User Sitemap
  • Privacy policy
  • Terms of conditions
  • black Facebook logo
  • black Twitter icon
  • greyscale YoutTube logo

We are using cookies to give you the best experience on our website.

You can find out more about which cookies we are using or switch them off in settings.

TITAN logo
Powered by  GDPR Cookie Compliance
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Strictly Necessary Cookies

Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.