Skip to main content
@capgo/capacitor-pdf-viewer Files & Storage Open source

PDF Viewer Capacitor plugin

Embed native PDF viewing on iOS, Android, and web with paths, URLs, base64, inline mode, and password support

Install

bun add @capgo/capacitor-pdf-viewer bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-pdf-viewer
  • pnpm add @capgo/capacitor-pdf-viewer
  • yarn add @capgo/capacitor-pdf-viewer

Guide

How to use PDF Viewer in Capacitor

Using @capgo/capacitor-pdf-viewer

Native PDF viewing on iOS (PDFKit), Android (Pdfium), and web with paths, URLs, base64, and inline mode.

Install

bun add @capgo/capacitor-pdf-viewer
bunx cap sync

What This Plugin Exposes

  • 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.
  • setZoom - Set the zoom scale multiplier.
  • getPluginVersion - Get the native or web implementation version marker.
  • addListener - Listen for load, pageChange, error, close, and linkTap events.

Example Usage

open

import { PdfViewer } from '@capgo/capacitor-pdf-viewer';

await PdfViewer.addListener('pageChange', ({ page, pageCount }) => {
  console.log(`Page ${page} of ${pageCount}`);
});

const { pageCount } = await PdfViewer.open({
  source: 'https://example.com/manual.pdf',
  mode: 'fullscreen',
  scrollMode: 'continuous',
  page: 1,
});

console.log(`Opened ${pageCount} pages`);

close

import { PdfViewer } from '@capgo/capacitor-pdf-viewer';

await PdfViewer.close();

Full Reference

FAQ

PDF Viewer plugin FAQ

How do I install the PDF Viewer plugin in a Capacitor app?

Run "bun add @capgo/capacitor-pdf-viewer" (or "npm install @capgo/capacitor-pdf-viewer"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-pdf-viewer" in your app code.

Does @capgo/capacitor-pdf-viewer work with React, Vue and Angular?

Yes. PDF Viewer is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-pdf-viewer support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-pdf-viewer free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-pdf-viewer/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses PDF Viewer without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship PDF Viewer changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo