PDF Viewer
PROView PDF documents inline with page navigation, zoom, and download controls.
Usage guide
#Let users view PDFs directly within a page using the browser's built-in PDF viewer.
- File and viewing area
- Set
srcto an accessible PDF URL, setfileName, and provide enough container height. The example below uses a two-page document. - Pages and zoom
setPage()accepts 1 or higher;setZoom()accepts 25–400.- Document tools
- Configure download, print, and fullscreen options for your use case.
Examples
#Feature examples
#Choose a feature from 24 topics. Explore property settings, method calls, event results, and slot layouts through live examples and code.
No matching features.
API reference
#Hover over a name or focus it with the keyboard to see the code. On touch screens, tap the name.
<sy-pdf-viewer>
Properties
| Attribute / Property | Type | Default | Description |
|---|---|---|---|
string | '' | PDF file URL. | |
string | 'document.pdf' | Download filename and accessible label. Spec name: `file-name`. | |
number | 1 | Current page number, starting at 1. | |
number | 100 | Zoom percentage, limited to 25–400. | |
string | '640px' | Height as a CSS length or a numeric string interpreted as pixels. | |
boolean | true | Show the toolbar above the viewer. Spec name: `show-toolbar`. | |
boolean | true | Expose the download action. | |
boolean | true | Expose the print action. | |
boolean | true | Expose the fullscreen toggle. | |
string | 'PDF preview is not available in this browser.' | Fallback message shown when the browser cannot render the PDF natively. Spec name: `fallback-text`. | |
string | 'No PDF selected' | Empty-state text when `src` is not provided. Spec name: `empty-text`. |
Events
| Event | Detail | Description |
|---|---|---|
CustomEvent<{ src: string }> | Read the result from the event's detail. | |
CustomEvent<{ src: string }> | Read the result from the event's detail. | |
CustomEvent<{ page: number }> | Read the result from the event's detail. | |
CustomEvent<{ zoom: number }> | Read the result from the event's detail. | |
CustomEvent<{ active: boolean }> | Read the result from the event's detail. |
Methods
| Method | Returns | Description |
|---|---|---|
Promise<void> | Change the PDF page, limited to 1 or higher. | |
Promise<void> | Change the PDF zoom level within 25–400%. | |
Promise<void> | Reload the current PDF. | |
Promise<void> | Open the PDF in a new window for printing. | |
Promise<void> | Request native fullscreen on the viewer host. | |
Promise<void> | Restore the window to its original size. | |
Promise<void> | Toggle between fullscreen and restored. |
Slots
| Slot | Description |
|---|---|
| Content displayed in the empty area. |