Client must be running?
Yes—use getConnectStatus; see error-handling.
printHtml is the primary web-print-pdf entry—local client renders HTML to PDF and prints. Covers four argument groups, patterns, pitfalls, and evaluation checklist for engineering leads.
printHtml(html, pdfOptions?, printOptions?, extraOptions?): Promise<PrintResult>| Arg | Stage | Guide |
|---|---|---|
| html | Input string | demos |
| pdfOptions | Layout → PDF | print options |
| printOptions | PDF → printer | print options |
| extraOptions | preview, timeout | print options |
import webPrintPdf from 'web-print-pdf';
if (!(await webPrintPdf.getConnectStatus())) {
throw new Error('Start the desktop client first');
}
await webPrintPdf.printHtml(html, pdfOptions, printOptions);| Pattern | Notes |
|---|---|
| DOM extract | ref innerHTML → printHtml |
| API HTML string | Full document from backend |
| Preview only | extraOptions.action preview |
Yes—use getConnectStatus; see error-handling.
Configure in pairs—especially paper size.
extraOptions.action = "preview".
Browser/client components only.
ByUrl fetches a URL; printHtml takes HTML string.
The same web-print-pdf front-end runs on Windows, macOS, and Linux/domestic OS—install the matching client on each desktop.