Skip to content

Base64 To PDF ​

A simple utility for Base64 encoded strings to decode and download them as PDF file.

Type: Building Block

Available in: App Page · Home Page · Record Page · Flow Screen

Base64 To PDF

Read on Medium ​

How to display and download Base64 encoded PDF documents with Lightning Web Components

How to display and download Base64 encoded PDF documents with Lightning Web Components

Attributes ​

NameTypeDefaultDescription
base64stringThe content of the PDF file as Base64 encoded string, without a data URL prefix. An example file is used until this is set.
file-namestring'example.pdf'The name of the downloaded file.

Usage ​

html
<c-base64-to-pdf base64={pdfContent} file-name="invoice.pdf"></c-base64-to-pdf>

The content is offered as a PDF download. Without the base64 attribute, the component offers an example file (see example.js). If base64 is set but empty, for example while your data is loading, it offers no download at all.

Custom Labels ​

The texts users see are Custom Labels, so they can be translated in Setup with the Translation Workbench. Copy them together with the component.

NameValue
Base64ToPdf_DownloadDownload PDF File
Base64ToPdf_TitleBase64 To PDF

Released under the MIT License. · llms.txt for AI agents