Skip to content

Getting Started

GitHub

You can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:

Terminal window
bunx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

Then use the following prompt:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-pdf-viewer` plugin in my project.

If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:

Terminal window
bun add @capgo/capacitor-pdf-viewer
bunx cap sync
import { PdfViewer } from '@capgo/capacitor-pdf-viewer';
import { PdfViewer } from '@capgo/capacitor-pdf-viewer';
const result = await PdfViewer.open({
source: 'https://example.com/manual.pdf',
headers: { Authorization: 'Bearer token' },
mode: 'fullscreen',
});
  • Listeners: remove handles when screens unmount.
  • Native sync: run bunx cap sync after plugin upgrades.
  • Source of truth: trust src/definitions.ts in the GitHub repo.
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',
headers: { Authorization: 'Bearer YOUR_TOKEN' },
mode: 'fullscreen',
scrollMode: 'continuous',
page: 1,
});
console.log(`Opened ${pageCount} pages`);
// Call PdfViewer.close() when the user dismisses the viewer or you navigate away.