Salesforce Developer Tutorial (LWC): How to Generate a PDF from a Lightning Web Component

Опубликовано: 21 Март 2026
на канале: Coding With The Force
22,104
324

In this episode we go over how to generate a PDF from an LWC by leveraging the opensource jsPDF library. It's surprisingly simple thankfully and you can generate pretty much anything you can think of!

Schedule Salesforce consulting time with me here: https://calendly.com/codingwiththefor...

Please consider donating to help continue to improve the content produced for Coding With The Force: https://www.paypal.com/donate?busines...

Get Coding With The Force Merch Here: https://my-store-d20559.creator-sprin...


GitHub Repo:
https://github.com/Coding-With-The-Fo...

jsPDF Repo: https://github.com/MrRio/jsPDF
jsPDF code download: https://cdnjs.cloudflare.com/ajax/lib...

Information on JS Destructuring: https://developer.mozilla.org/en-US/d...

LWC Lifecycle Hooks: https://developer.salesforce.com/docs...

Follow all of our social media here:

Patreon:   / codingwiththeforce  
Github: https://github.com/Coding-With-The-Force
Facebook:   / codingwiththeforce  
Twitter:   / coding_force  
Instagram:   / codingwiththeforce  

Salesforce development books I recommend:

Advanced Apex Programming: https://amzn.to/3lXi8to
Salesforce Lightning Platform Enterprise Architecture: https://amzn.to/2R0D4BQ
Mastering Salesforce DevOps: https://amzn.to/3lTtTRN
Apex Design Patterns Book: https://amzn.to/3DwqljP


Good Non-SF Specific Development Books:

Clean Code: https://amzn.to/35PuMDU
Clean Architecture: https://amzn.to/35FYo6A
Design Patterns: Elements of Reusable Object-Oriented Software Book: https://amzn.to/3LhvHBd

-------------------------------------------------------------------------------------------------------------------------

Table of Contents:

0:00 - Intro
0:18 - Why create an LWC to generate PDF's
2:53 - The jsPDF library and static resources
6:12 - Building the Lightning Web Component
32:15 - Putting the LWC on a Lightning App Page
32:53 - Demoing the PDF Generation component
33:12 - Showing additional jsPDF features
34:18 - Outro

DISCLAIMER: The views and ideas expressed on this YouTube channel and blog are based on past development experiences and may not always work for your particular scenarios. The advice in these videos may also become outdated as technology advances. They should be used as examples for educational purposes only. Using any shown solutions in your own org is not advisable since they are example scenarios.

#salesforce #salesforcedeveloper #salesforceadmin