Skip to main content

cordova-plugin-printer Alternative for Capacitor

cordova-plugin-printer alternative for Capacitor: @capgo/capacitor-printer with printHtml, printFile, printPdf, printBase64, and printWebView instead of cordova-plugin-printer callbacks.

Illustration of migrating a Cordova app to Capacitor, used for a printer plugin guide

The practical cordova-plugin-printer alternative for a Capacitor app is @capgo/capacitor-printer. Cordova sends one cordova.plugins.printer.print call with either HTML text or a file URI and a large options object. Capgo exposes explicit print methods for HTML, on-disk files, PDFs, base64 data, and the live WebView. This guide lists npm facts, install steps, usage, and an API map for your Cordova to Capacitor move.

Why leave cordova-plugin-printer in Capacitor

cordova-plugin-printer on npm is version 0.8.0. The registry modified timestamp is 14 June 2022. The npm repository URL points to katzer/cordova-plugin-printer.

www/printer.js documents cordova.plugins.printer with:

  • print(content, options, callback, scope) where content is plain or HTML text, or null with options only
  • pick(options, callback) to choose a printer on iOS
  • canPrintItem(uri, callback) and getPrintableTypes(callback)
  • deep options for duplex, paper, margins, headers, and footers merged from _defaults

In Capacitor you still depend on Cordova exec strings, callback wiring, and a single entry point that mixes HTML strings with filesystem URIs.

@capgo/capacitor-printer latest on npm is 8.1.11 with a modified date of 12 November 2026. src/definitions.ts documents printHtml, printFile, printPdf, printBase64, printWebView, and printIframe. Capgo ships fixes on an open source cadence where a human still reviews, tests and merges 50+ pull requests daily.

Install

bun add @capgo/capacitor-printer
bunx cap sync

Use @capacitor/filesystem when you save PDFs locally before calling printFile or printPdf.

Usage example

import { Printer } from '@capgo/capacitor-printer';

export async function printReceipt(html: string) {
  await Printer.printHtml({
    name: 'Receipt',
    html: `<!DOCTYPE html><html><body>${html}</body></html>`,
  });
}

Migrating from Cordova to Capacitor

// Before (Cordova)
cordova.plugins.printer.print('<h1>Invoice</h1>', { name: 'Invoice' }, onDone);
// After (Capacitor)
import { Printer } from '@capgo/capacitor-printer';

await Printer.printHtml({
  name: 'Invoice',
  html: '<!DOCTYPE html><html><body><h1>Invoice</h1></body></html>',
});
// Before (Cordova)
cordova.plugins.printer.print('file:///path/to/report.pdf', { name: 'Report' }, onDone);
// After (Capacitor)
await Printer.printPdf({
  name: 'Report',
  path: 'file:///path/to/report.pdf',
});

API mapping table

cordova-plugin-printer (cordova.plugins.printer) @capgo/capacitor-printer
print(htmlString, options) printHtml({ html, name: options.name })
print(fileUri, options) printFile({ path: fileUri, mimeType, name }) or printPdf({ path, name }) for PDF
Base64 or binary content in options printBase64({ data, mimeType, name })
Print current WebView or page printWebView({ name })
Large HTML in iframe printIframe({ selector, name })
pick(options, callback) (iOS) Use system print dialog from any print method; no separate picker API
canPrintItem(uri, callback) Validate path with printFile / printPdf and handle errors
getPrintableTypes(callback) MIME types listed in PrintBase64Options and PrintFileOptions docs
options.name job name name on every print method (PrintOptions)
Cordova duplex, paper, margin objects Use CSS @media print in printHtml HTML; Capgo does not mirror every Cordova layout option
Not in Cordova getPluginVersion()
Cordova plugin install bun add @capgo/capacitor-printer plus bunx cap sync

Generate PDFs in the native shell with Capgo Build, then ship receipt template tweaks with Capgo live updates. For the full platform move, read the Cordova to Capacitor migration guide.

Live updates for Capacitor apps

When a web-layer bug is live, ship the fix through Capgo instead of waiting days for app store approval. Users get the update in the background while native changes stay in the normal review path.

Latest from our Blog

Capgo gives you the best insights you need to create a truly professional mobile app.