PDF・ファイルを印刷
PDF などのファイルのシステム印刷 UI を出します。Android と iOS のみです。インストール のあとで呼び出します。現在の WebView を印刷する場合は WebViewを印刷 です。
アプリがすでに書き出した実在するローカルファイルのパスを渡します(プレースホルダー文字列ではありません)。Android はファイルパス、file:// URL、content:// URL に対応します。iOS はファイルパスとローカル file:// URL です。mimeType は Android のみです。
import { Printer } from '@rdlabo/capacitor-printer';
// filePath must point to a file that exists on the device.
await Printer.printFile({ path: filePath });
// After await settles, the OS no longer needs the source; delete it then if you no longer need it.
method printFile(...)
Present the printing user interface to print a file.
The promise settles after the operating system no longer needs the source
file, so the file can be safely deleted in a finally block.
Only available on Android and iOS.
printFile(options: PrintFileOptions) => Promise<void>
interface PrintFileOptions
| Prop | Type | Description |
|---|---|---|
path |
string |
The path to the file. Android supports file paths, file:// URLs, and content:// URLs. iOS supports file paths and local file:// URLs. |
mimeType |
string |
The MIME type of the file. Only used on Android. |