Item | Value |
|---|---|
Effect helper | ctx.effects.print_pdf(request) |
Capability | PRINT_PDF (fission.print.pdf) |
Request | PrintPdfRequest |
PDF source | FileWriteSource::Bytes / FileWriteSource::Stream |
Page range | PrintPageRange { first_page, last_page } |
Result | PrintPdfResult { outcome, job_id } |
Error | PrintError { code, message } |
CLI value | none required |
let request = PrintPdfRequest {
pdf: FileWriteSource::Stream(generated_pdf),
job_name: Some("Quarterly report".into()),
copies: 1,
page_ranges: Vec::new(),
};
ctx.effects.print_pdf(request)
let printed = ctx.effects.bind(PrintFinished, reduce_with!(on_print_finished));
let failed = ctx.effects.bind(PrintFailed, reduce_with!(on_print_failed));
ctx.effects.print_pdf(request).on_ok(printed).on_err(failed);
#[fission_reducer(PrintFinished)]
fn on_print_finished(state: &mut AppState, ctx: &mut ReducerContext<AppState>) {
if let Some(result) = ctx.input.capability_ok(PRINT_PDF) {
state.print_outcome = Some(result.outcome);
state.print_error = None;
}
}
#[fission_reducer(PrintFailed)]
fn on_print_failed(state: &mut AppState, ctx: &mut ReducerContext<AppState>) {
state.print_error = ctx.input.capability_error(PRINT_PDF);
}
Outcome or error | Meaning |
|---|---|
PrintOutcome::Submitted | The native print service accepted the job or the Windows print action launched. This is not a physical completion receipt. |
PrintOutcome::Presented | A browser or Android print surface opened. Those APIs do not report the user's final choice to Fission. |
PrintOutcome::Cancelled | iOS reported that the user dismissed its print sheet before submission, or the browser print window closed before loading. |
PrintError with code = "unsupported" | The active host has no configured print provider or cannot apply the requested settings. |
popup_blocked, print_failed, print_submission_failed | The browser blocked its print window, or a host failed to present/submit the document. |
Target | Behavior |
|---|---|
Linux, macOS | Sends PDF bytes to CUPS using lp or lpr. Copy count and page ranges are passed to the print service. |
Windows | Writes a temporary PDF for the registered PDF handler's print verb. The host reports when that print action launches. Requested page/copy overrides return unsupported. |
Web | Opens a blank print window before it awaits a stream, preserving the click's popup activation; then loads the PDF and invokes the browser print UI. Allow popups for the site. Browser print settings are chosen in that dialog. |
Android | Uses PrintManager and the system print sheet. The current adapter accepts all pages; Fission reports a write error instead of silently ignoring a selected page range. |
iOS | Uses UIPrintInteractionController; the completion callback distinguishes submission, cancellation, and errors. The print sheet provides page and copy controls. |
Static site, SSR browser client | Uses the Web behavior when running in a browser. |
Terminal, SSR server process | Returns a typed unsupported error. |