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

PDF Generator Capacitor plugin

Create PDF documents from HTML templates for invoices, reports, and receipts

Install

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

Guide

How to use PDF Generator in Capacitor

Test on device

Download the Capgo app, then scan the QR code.

PDF Generator plugin preview QR code

Using @capgo/capacitor-pdf-generator

Generate PDF files from HTML strings or URLs on iOS and Android.

Install

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

bunx cap sync copies the plugin's native code into your native projects. Run it again after every plugin upgrade.

Import

import { PdfGenerator } from '@capgo/capacitor-pdf-generator';

API at a glance

Method Description
fromURL Generates a PDF from the provided URL.
fromData Generates a PDF from a raw HTML string.

Examples

fromURL()

Generates a PDF from the provided URL.

import { PdfGenerator } from '@capgo/capacitor-pdf-generator';

const result = await PdfGenerator.fromURL({ url: 'https://example.com' });
console.log(result);

fromData()

Generates a PDF from a raw HTML string.

import { PdfGenerator } from '@capgo/capacitor-pdf-generator';

const result = await PdfGenerator.fromData({ data: 'data' });
console.log(result);

Full reference

Keep going from Using @capgo/capacitor-pdf-generator

If you are using Using @capgo/capacitor-pdf-generator to plan storage and file handling, connect it with @capgo/capacitor-pdf-generator for the implementation detail in @capgo/capacitor-pdf-generator, Getting Started for the implementation detail in Getting Started, @capgo/capacitor-data-storage-sqlite for the implementation detail in @capgo/capacitor-data-storage-sqlite, Using @capgo/capacitor-data-storage-sqlite for the native capability in Using @capgo/capacitor-data-storage-sqlite, and @capgo/capacitor-file for the implementation detail in @capgo/capacitor-file.

FAQ

PDF Generator plugin FAQ

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

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

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

Yes. PDF Generator 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-generator 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-generator free and open source?

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

Can I update code that uses PDF Generator 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 Generator 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