underWebView / toBack
Open with mode: 'underWebView' or toBack: true to place the native PDF behind a transparent Capacitor WebView. nativeUi defaults to false in this mode so you can ship
your own HTML chrome.
underWebView / toBack
Open with mode: 'underWebView' or toBack: true to place the native PDF behind a transparent Capacitor WebView. nativeUi defaults to false in this mode so you can ship
your own HTML chrome.
Custom HTML controls
Draw toolbars, page indicators, and buttons in HTML (Ionic, Tailwind, or plain markup). The native layer keeps PDFKit / Pdfium scroll, pinch zoom, and link hit testing.
Touch routing
Touches on button, a, form controls, [data-capgo-pdf-interactive], .custom-toolbar, and .custom-pdf-ui button stay in the WebView. Other touches go to the PDF.
updateLayout()
Reposition or resize the native PDF in CSS pixels relative to the WebView viewport. Call it after rotation or when your chrome changes size.
Embed native PDF viewing on iOS, Android, and web with paths, URLs, base64, inline mode, password support, and an optional underWebView presentation for custom HTML UI.
Start with open() and the other core methods listed below.
| Platform | Support | Notes |
|---|---|---|
| iOS | Yes | PDFKit. underWebView / toBack is supported. hide() and show() are accepted only in underWebView or inline mode. |
| Android | Yes | Pdfium. underWebView / toBack is supported. hide() and show() work in any open mode. |
| Web | Partial | Browser PDF viewer with blob URLs. underWebView / toBack is not available. Use fullscreen or inline. nativeUi: false with mode: 'fullscreen' is rejected. |
open - Open a PDF from a file, path, URL, or base64 source, including mode: 'underWebView' or toBack: true.close - Close the active viewer and remove any overlay.goToPage / nextPage / previousPage - Jump or step through 1-based pages.setZoom - Set the zoom scale multiplier (1 is the default fit scale on native).hide / show - Hide or show the PDF layer without unloading the document.updateLayout - Reposition or resize the native PDF in underWebView / toBack mode.| Method | Description |
|---|---|
open | Open a PDF from a file, path, URL, or base64 source. |
close | Close the active viewer and remove any overlay. |
goToPage | Jump to a 1-based page number. |
nextPage | Move to the next page when one exists. |
previousPage | Move to the previous page when one exists. |
setZoom | Set the zoom scale multiplier. On web this resolves without changing the browser zoom. |
getPageCount | Read the total page count. On web this always returns 1. |
getCurrentPage | Read the current 1-based page. On web this reflects the last programmatic page only. |
hide | Hide the PDF layer without unloading the document. |
show | Show the PDF layer after hide(). |
updateLayout | Reposition or resize the native PDF when using underWebView / toBack. |
getPluginVersion | Get the native or web implementation version marker. |
addListener | Listen for load, pageChange, zoomChange, error, close, and linkTap events. |
This reference is synced from src/definitions.ts in capacitor-pdf-viewer.
If you are using @capgo/capacitor-pdf-viewer in your Capacitor app, connect it with Using @capgo/capacitor-pdf-viewer for the SEO tutorial and related Capgo plugin docs.