PDF

Updated at:

Introduction

The PDF component is a user interface element that allows users to view, manage, and download PDF documents.

Configurations

Category

Configuration

Example

Description

Content

PDF source

The three modes for the PDF source.

URL

Applies when the PDF source is URL. The value is the link to the PDF document.

System file

Applies when the PDF source is System file. Select a PDF document uploaded to the built-in resource files, or click the selection box below to upload a file directly.

Memory object

image

Applies when the PDF source is Memory object. It can be associated with the upload component. For example: upload1.values?.[0]. This is used for scenarios that do not require an actual upload.

Current page number

The page number of the current page in the PDF document.

Show toolbar

Specifies whether to show the header toolbar.

Interaction

Hidden

Controls the default display state of the PDF component. If set to true, the component is hidden. For more information, see Common properties

Style

Height

For more information, see Common properties

Margin

For more information, see Common properties

Properties and methods

Name

Type

Example

Description

src

string

pdf1.src

The link to the current PDF document.

file

object

pdf1.file

Read-only. The PDF document file resource.

pageNumber

number

pdf1.pageNumber

The current page number of the PDF document.

totalPageNumber

number

pdf1.totalPageNumber

The total number of pages in the PDF document.

title

string

pdf1.title

The title of the PDF component.

setPageNumber

func

pdf1.PageNumber(2)

Sets the page number of the PDF document to 2.

clearPageNumber

func

pdf1.clearPageNumber()

Clears the page number of the PDF document.

downloadToImage

func

pdf1.downloadToImage(2)

Downloads page 2 of the PDF document as an image.

download

func

pdf1.download()

Downloads the PDF document.

getCurrentPageDataURL

func

pdf1.getCurrentPageDataURL()

Gets the dataURL encoded data of the current page.