One.Print presents the iOS print sheet for a PDF already stored in the app’s readable local files. It does not generate PDF content or download remote URLs. Use FileSystem to write a PDF or DocumentPicker to copy one into the app first.
import { One } from 'one'
if (await One.Print.isAvailable()) { const result = await One.Print.printPdf(fileUri, 'Invoice') if (result.completed) { // the system print sheet completed its request }}printPdf(fileUri, jobName?) requires a local file:// URI pointing to an existing, readable PDF with at least one page. jobName defaults to the PDF filename without its extension. No manifest setting is required. The method accepts one open sheet at a time. Tapping the system Cancel button resolves { completed: false }; a completed system request resolves { completed: true }. Completion does not prove that a printer delivered paper. isAvailable() reports whether iOS can present printing, even when no printer is selected.
Invalid JavaScript argument types and empty strings throw before reaching native code. Native failures use these codes: E_PRINT_INPUT for a direct native empty job name, E_PRINT_URI for a nonlocal URI, E_PRINT_FILE for a missing file or directory, E_PRINT_PDF for invalid or empty PDF content, E_PRINT_BUSY for a second request, E_PRINT_UNAVAILABLE when printing is unavailable, E_PRINT_PRESENTATION when the app has no active presenter or the sheet does not open, and E_PRINT_FAILED when the system reports a print error.
Printing is implemented on iOS and Android. On Android each page rasterizes through the platform PDF renderer at the print job’s resolution into the system print sheet, and isAvailable() is false when no print service handles the job. On web, isAvailable() resolves false; printPdf() validates its arguments and rejects with Print.printPdf needs an iOS or Android build. Browsers expose window.print() for the current document, but it cannot print this method’s PDF URI and report whether printing completed. printPdf therefore retains its unavailable contract on web. The iOS 27 simulator can prove sheet presentation and cancellation, but an actual AirPrint job needs a printer and device proof.
Edit this page on GitHub.