The PDF component for Retool Apps
A content area to embed a PDF.
For more information about this component, refer to the Embedded media guide.
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 |
Default | false |
Examples
true
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 |
Default | false |
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 |
Default | true |
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 |
Default | false |
Examples
true
margin
The amount of margin to render outside.
Type | string | |||||||||
Format | Plain Text | |||||||||
Configurability | Inspector > Spacing > Margin | |||||||||
Allowed Values |
| |||||||||
Default | 4px 8px |
Examples
4px 8px
retoolFileObject
The file's data when using a file not stored in Retool Storage.
Type | object |
Configurability | Read-only |
Default | null |
Object Properties
Examples
{
"name": "sample.pdf",
"type": "application/pdf",
"sizeBytes": 10523,
"base64Data": "JVBERi0xLjQKJeLjz9...G"
}
retoolStorageDynamicInput
Whether retoolStorageFileId
is set dynamically.
Type | string |
Configurability | Read-only |
Default | null |
retoolStorageFileId
The unique identifier for a file in Retool Storage.
Type | string |
Format | UUID |
Configurability | Inspector > Content > File input |
Default | null |
scaleMode
The scaling mode for the PDF.
Type | string | ||||||
Configurability | Inspector | ||||||
Allowed Values |
| ||||||
Default | null |
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 |
Default | false |
Examples
true
showRotateButton
Whether to show the rotate button.
Type | boolean |
Format | True/False |
Configurability | Inspector > Content > Add-ons > Rotate button |
Default | false |
showTopBar
Whether to display a toolbar.
Type | boolean |
Format | True/False |
Configurability | Inspector > Content > Add-ons > Top bar |
Default | false |
showZoomControls
Whether to show the zoom controls.
Type | boolean |
Format | True/False |
Configurability | Inspector > Content > Add-ons > Zoom controls |
Default | false |
Examples
https://upload.wikimedia.org/wikipedia/commons/1/14/Marspathfinder.pdf
srcType
The source type.
Type | string | ||||||||||||
Configurability | Inspector | ||||||||||||
Allowed Values |
| ||||||||||||
Default | null |
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.
pdf.scrollIntoView(options)
Parameters
Object Properties
behavior
The scroll behavior.
Type | string | ||||||
Allowed Values |
|
block
The scroll position relative to the component.
Type | string | ||||||||||
Allowed Values |
|
Examples
Scroll the minimum amount to immediately bring pdf
into view.
pdf.scrollIntoView({behavior: 'auto', block: 'nearest'});
pdf.setFileUrl(src)
Parameters
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.
pdf.setHidden(hidden)
Parameters
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.
Event | Description |
---|