New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@capgo/capacitor-pdf-generator

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capgo/capacitor-pdf-generator

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

latest
Source
npmnpm
Version
8.0.21
Version published
Maintainers
1
Created
Source

@capgo/capacitor-pdf-generator

Capgo - Instant updates for capacitor

Generate PDF files from HTML strings or remote URLs.

Port of the Cordova pdf-generator plugin for Capacitor with a modernized native implementation.

Documentation

The most complete doc is available here: https://capgo.app/docs/plugins/pdf-generator/

Compatibility

Plugin versionCapacitor compatibilityMaintained
v8.*.*v8.*.*
v7.*.*v7.*.*On demand
v6.*.*v6.*.*
v5.*.*v5.*.*

Note: The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.

Install

npm install @capgo/capacitor-pdf-generator
npx cap sync

Usage

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

const result = await PdfGenerator.fromData({
  data: '<html><body><h1>Hello Capgo</h1></body></html>',
  documentSize: 'A4',
  orientation: 'portrait',
  type: 'base64',
  fileName: 'example.pdf',
});

if (result.type === 'base64') {
  console.log(result.base64);
}

API

fromURL(...)

fromURL(options: PdfGeneratorFromUrlOptions) => Promise<PdfGeneratorResult>

Generates a PDF from the provided URL.

ParamType
optionsPdfGeneratorFromUrlOptions

Returns: Promise<PdfGeneratorResult>

fromData(...)

fromData(options: PdfGeneratorFromDataOptions) => Promise<PdfGeneratorResult>

Generates a PDF from a raw HTML string.

ParamType
optionsPdfGeneratorFromDataOptions

Returns: Promise<PdfGeneratorResult>

getPluginVersion()

getPluginVersion() => Promise<{ version: string; }>

Get the native Capacitor plugin version

Returns: Promise<{ version: string; }>

Interfaces

PdfGeneratorFromUrlOptions

PropType
urlstring

PdfGeneratorFromDataOptions

PropTypeDescription
datastringHTML document to render.
baseUrlstringBase URL to use when resolving relative resources inside the HTML string. When omitted, about:blank is used.

Type Aliases

PdfGeneratorResult

{ type: 'base64'; base64: string; } | { type: 'share'; completed: boolean; }

Keywords

capacitor

FAQs

Package last updated on 16 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts