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
npx 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
npm install @capgo/capacitor-pdf-viewer
npx cap sync
import { PdfViewer } from '@capgo/capacitor-pdf-viewer';
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.