Skip to main content

The PDF component for Retool Apps

A content area to embed a PDF.

Properties

All properties for this object with supported data types or values. You can write JavaScript almost anywhere in Retool to manipulate or read property values.

hidden

Whether this object is hidden from view.

Type boolean
Format True/False
Configurability Inspector > Appearance > Hidden
Defaultfalse
Examples
true

id

The unique identifier (name).

Type string
Format Plain Text
Configurability Inspector
Defaultpdf1
Examples
query1
button1

isHiddenOnDesktop

Whether to show or hide this object in the desktop layout.

Type boolean
Format True/False
Configurability Inspector > Appearance > Advanced > Show on desktop
Defaultfalse
Examples
true

isHiddenOnMobile

Whether to show or hide this object in the mobile layout.

Type boolean
Format True/False
Configurability Inspector > Appearance > Advanced > Show on mobile
Defaulttrue
Examples
true

maintainSpaceWhenHidden

Whether to take up space on the canvas if hidden is true.

Type boolean
Format True/False
Configurability Inspector > Appearance > Advanced > Maintain space when hidden
Defaultfalse
Examples
true

margin

The amount of margin to render outside.

Type string
Format Plain Text
Configurability Inspector > Spacing > Margin
Allowed Values
ValueUI OptionDescription
4px 8pxNormal

Normal margin.

0None

No margin.

Default4px 8px
Examples
4px 8px

retoolFileObject

The file's data when using a file not stored in Retool Storage.

Type object
Configurability Read-only
Defaultnull
Object Properties

base64Data

The base64 encoded data of the file.

Type string
Configurability Read-only
Defaultnull

sizeBytes

The size of the file in bytes.

Type number
Configurability Read-only
Defaultnull

type

The MIME type.

Type string
Configurability Read-only
Defaultnull

name

The file name.

Type string
Configurability Read-only
Defaultnull

Examples
{
"name": "sample.pdf",
"type": "application/pdf",
"sizeBytes": 10523,
"base64Data": "JVBERi0xLjQKJeLjz9...G"
}

retoolStorageDynamicInput

Whether retoolStorageFileId is set dynamically.

Type string
Configurability Read-only
Defaultnull

retoolStorageFileId

The unique identifier for a file in Retool Storage.

Type string
FormatUUID
Configurability Inspector > Content > File input
Defaultnull

scaleMode

The scaling mode for the PDF.

Type string
Configurability Inspector
Allowed Values
ValueDescription
width

Scale the PDF to fit the width.

fill

Scale the PDF to fit the height.

Defaultnull

scrollSnap

Whether to snap to the nearest page.

Type boolean
Configurability Read-only
Defaultnull

showInEditor

Whether the component remains visible in the editor if hidden is true.

Type boolean
Format True/False
Configurability Inspector > Appearance > Advanced > Always show in edit mode
Defaultfalse
Examples
true

showRotateButton

Whether to show the rotate button.

Type boolean
Format True/False
Configurability Inspector > Content > Add-ons > Rotate button
Defaultfalse


showZoomControls

Whether to show the zoom controls.

Type boolean
Format True/False
Configurability Inspector > Content > Add-ons > Zoom controls
Defaultfalse

src

The data source.

Type string
Formatstring
Configurability Inspector
Defaultnull
Examples
https://upload.wikimedia.org/wikipedia/commons/1/14/Marspathfinder.pdf

srcType

The source type.

Type string
Configurability Inspector
Allowed Values
ValueDescription
src

URL.

retoolStorageFileId

Retool Storage file.

retoolFileObject

Retool file object.

dbBlobId

Database blob.

storageBlobId

Storage blob.

Defaultnull

style

Custom style options.

Type object
Configurability Inspector > Appearance > style
Defaultnull

title

The title text to display.

Type string
Configurability Inspector
Defaultnull

Methods

JavaScript API methods for this object. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.

pdf.scrollIntoView()

Scrolls the canvas or parent container so that the selected component appears in the visible area.

Definition
pdf.scrollIntoView(options)
Parameters

options

The scroll options.

Type object
Object Properties

behavior

The scroll behavior.

Type string
Allowed Values
ValueDescription
auto

Scroll immediately to the specified position.

smooth

Scroll gradually to the specified position.


block

The scroll position relative to the component.

Type string
Allowed Values
ValueDescription
nearest

Scrolls only the minimum amount required for the component to appear in the visible area. Scrolling does not occur if the component is already in view.

start

Scrolls to position the component at the top of the visible area.

center

Scrolls to position the component in the middle of the visible area.

end

Scrolls to position the component at the bottom of the visible area.



Examples

Scroll the minimum amount to immediately bring pdf into view.

pdf.scrollIntoView({behavior: 'auto', block: 'nearest'});

pdf.setFileUrl()

Set the URL of the file.

Definition
pdf.setFileUrl(src)
Parameters

src

The data source.

Type string
Formatstring
Examples
https://upload.wikimedia.org/wikipedia/commons/1/14/Marspathfinder.pdf

Examples

Set the URL of the file for pdf.

pdf.setFileUrl('https://example.com/example.png');

pdf.setHidden()

Set the hidden value to toggle whether the component is visible. Defaults to true without a parameter.

Definition
pdf.setHidden(hidden)
Parameters

hidden

Whether this object is hidden from view.

Type boolean
Format True/False
Default
false
Examples
true

Examples

Hide pdf.

pdf.setHidden(true);

Unhide pdf.

pdf.setHidden(false);

Events

Events triggered by user interactions. You can configure event handlers in the IDE to trigger queries or other actions in response to events.

EventDescription