lib/print-jobs
Documents printed in the session, delivered as PDFs.
The server announces each document that lands in its print spool. It is
fetched once, which takes it out of the spool, handed to the dashboards
as a blob URL on the printDocument window message, and opened in the
browser's print dialog when automatic printing is on. A dashboard's
printRequest message prints one again.
The dialog is reached through a frame showing the PDF, which a desktop engine renders with a viewer that prints it. A phone or tablet browser has no such viewer in a frame: WebKit rasterises the first page into an image, Chrome for Android loads nothing, and neither throws, so printing there would print a blank frame or nothing at all. On a touch-first client the document is instead opened as a tab of its own, where the browser's own PDF viewer prints and saves it. A new tab needs a user gesture, which an announcement arriving over the socket has none of, so automatic printing does nothing there and the dashboards raise a notice with an open link per document, since their menus are closed while an application prints.
Functions
printDocument()
function printDocument(url): void;Defined in: lib/print-jobs.js:38
Prints the PDF at url: on a desktop through a frame of no size, so the
document prints rather than the page around it, and the frame goes once
the dialog closes; on a touch-first client by opening it in a new tab,
which reaches the browser's own viewer only from within a user gesture.
Parameters
| Parameter | Type | Description |
|---|---|---|
url | string | Blob URL of the PDF. |
Returns
void
createPrintJobs()
function createPrintJobs(options): object;Defined in: lib/print-jobs.js:65
Parameters
| Parameter | Type | Description |
|---|---|---|
options | { automatic: boolean; } | - |
options.automatic | boolean | Whether an announced document is printed at once. |
Returns
object
announce
announce: (arg0, arg1) => Promise<void>;Parameters
| Parameter | Type |
|---|---|
arg0 | string |
arg1 | number |
Returns
Promise<void>
setAutomatic
setAutomatic: (arg0) => void;Parameters
| Parameter | Type |
|---|---|
arg0 | boolean |
Returns
void