Menu

1 / 3

How to Scan a Document to PDF in a Capacitor App

DEV Community: ionic·Robin·5 days ago
#K8Sxb6si
#devtoionic#devto#dev#plugin#capacitor
Reading 0:00
15s threshold

Originally published on the Capawesome blog .

A signed contract that comes out of a scanner as a folder of JPEGs is hard to email, print or file, so most apps want one PDF instead. The Capacitor Document Scanner plugin returns that PDF next to the individual page images when you pass generatePdf: true to scanDocument(...) . This guide shows how to scan a document to PDF in a Capacitor app and what to do with the file afterwards, from opening it in a native viewer to printing it, sharing it and keeping it past the next app launch. The scanner and the Capacitor Printer plugin are part of Capawesome Insiders ; the PDF viewer, the file opener and the official Share and Filesystem plugins are free.

Key takeaways:

scanDocument({ generatePdf: true }) returns one combined PDF in pdf and still returns every page as a JPEG in scannedImages , from the same scan.

On Android, Google's ML Kit generates the PDF; on iOS, VisionKit returns only page images, and the plugin composes an image-only PDF from them.

The pdf…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.