Printing
Bridges for triggering the native print dialog from your page.
Android
Bridge object: AndroidPrint
Method | Description |
|---|
AndroidPrint.isAvailable()
| Returns "true"/"false" string |
AndroidPrint.test()
| Returns "AndroidPrint bridge is accessible" |
AndroidPrint.printWebView(jobName)
| Prints the current WebView page |
AndroidPrint.printIframe(iframeId, jobName)
| Prints an iframe (falls back to current page) |
AndroidPrint.printHtml(htmlContent, jobName)
| Renders and prints an HTML string |
AndroidPrint.printImage(base64Image, jobName)
| Prints a base64-encoded image |
AndroidPrint.printPdf(base64Pdf, jobName)
| Prints a base64-encoded PDF |
Notes
base64Image and base64Pdf can include or omit the data:...;base64, prefix, it is stripped automatically.
printImage renders the image scaled and centered on an A4 page.
printPdf writes raw PDF bytes to the print system.
Example
// Print current page
AndroidPrint.printWebView('Invoice #1042');
// Print HTML string
const html = '<h1>Hello</h1><p>This is a printable document.</p>';
AndroidPrint.printHtml(html, 'My Document');
// Print base64 image
const base64 = getBase64Image(); // your function
AndroidPrint.printImage(base64, 'Photo');
// Print base64 PDF
fetch('/invoice.pdf')
.then(r => r.blob())
.then(blob => {
const reader = new FileReader();
reader.onloadend = () => {
const base64 = reader.result.split(',')[1];
AndroidPrint.printPdf(base64, 'Invoice');
};
reader.readAsDataURL(blob);
});
iOS
Bridge object: ApplePrint (injected shim)
ApplePrint.print(options?)
Parameter | Type | Description |
|---|
options.jobName
| string
| Optional name shown in print dialog |
Print Result Events
Event name | event.detail shape
| Description |
|---|
mobiweb:applePrintSuccess
| { completed: true }
| Print job completed |
mobiweb:applePrintFailed
| { error: string }
| Print job failed |
mobiweb:applePrintCancelled
| { cancelled: true }
| User cancelled print |
Example
ApplePrint.print({ jobName: 'Invoice #1042' });
window.addEventListener('mobiweb:applePrintSuccess', () => {
console.log('Printed successfully');
});
window.addEventListener('mobiweb:applePrintFailed', (e) => {
console.error('Print error:', e.detail.error);
});
window.addEventListener('mobiweb:applePrintCancelled', () => {
console.log('User cancelled print');
});
03 May 2026