Prise en main
Copier un prompt de configuration avec les étapes d'installation et le guide Markdown complet pour ce plugin.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-pdf-viewer`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/pdf-viewer/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Installer
Section intitulée « Installer »Vous pouvez utiliser notre configuration assistée par l'IA pour installer le plugin. Ajoutez les Capgo compétences à votre outil IA en utilisant la commande suivante :
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsEnsuite, utilisez la prompt suivante :
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-pdf-viewer` plugin in my project.Si vous préférez la configuration manuelle, installez le plugin en exécutant les commandes suivantes et suivez les instructions spécifiques à la plateforme ci-dessous :
npm install @capgo/capacitor-pdf-viewernpx cap syncImporter
Section intitulée « Importer »import { PdfViewer } from '@capgo/capacitor-pdf-viewer';Configuration du plateforme
Section intitulée « Configuration du plateforme »- Configuration iOS PDFKit, sans clés plist supplémentaires).
- Configuration Android Pdfium,
INTERNETpour les sources HTTPS).
Utilisation
Section intitulée « Utilisation »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.