macOS deployment & integration
Deploy the Web Print Expert client on macOS 11+ (Apple Silicon / Intel) and integrate web-print-pdf for silent web printing and HTML to PDF. APIs match Windows and Linux for a single front-end codebase.
Three client editions
| 版本 | 平台 | 打印后端 | 安装包 |
|---|---|---|---|
| Windows 版 | Windows 10/11 | 内置静默打印引擎 | .exe |
| Linux 版 | x64 / arm64 | 系统标准打印服务 | .deb / .rpm |
| macOS 版 | macOS 11+(Apple Silicon / Intel) | CUPS 打印系统 | .dmg |
Windows, Linux, and macOS ship as separate installers but share the same WebSocket API (/websocket/standard)—front-end web-print-pdf code stays platform-agnostic.
End-user dmg install
- Download the macOS dmg from the download page.
- Open the dmg and drag Web Print Expert into Applications.
- Launch the client, complete setup, and verify the local print service.
npm install web-print-pdf—same APIs as on Windows / Linux.
| 项 | 说明 |
|---|---|
| 安装方式 | Open dmg, drag to Applications |
| 芯片架构 | Apple Silicon (M-series) and Intel supported |
| 系统版本 | macOS 11 Big Sur 及以上 |
| 启动 | Launch from Launchpad or Applications folder |
First launch & Gatekeeper
macOS may block the app as from an unidentified developer. Try:
- Right-click the app in Finder → Open, then confirm.
- Or go to System Settings → Privacy & Security and click Open Anyway.
- Enterprises can allowlist via MDM to avoid per-machine steps.
Front-end integration (same API as Win/Linux)
Browser pages on macOS use the same npm package and calls as Windows and Linux:
npm install web-print-pdf
Minimal runnable example (client must be running):
import webPrintPdf from 'web-print-pdf';
// 1. 确认本地 WS 服务可用
const status = await webPrintPdf.utils.getConnectStatus();
if (!status.success) {
throw new Error('请先启动 Web打印专家客户端');
}
// 2. 获取 macOS 上已安装的打印机(CUPS 名称)
const printers = await webPrintPdf.utils.getPrinterList();
const list = printers.data ?? printers;
console.log(list);
// 3. 静默打印 HTML
await webPrintPdf.printHtml(
'<h1>出库单</h1><p>单号:SO-20260624</p>',
{ paperFormat: 'A4', margin: { top: '10mm', bottom: '10mm' } },
{ printerName: (list[0] && list[0].name) || '默认打印机', copies: 1 }
);
Local service: ws://127.0.0.1:{port}/websocket/standard—port shown in the client UI. web-print-pdf connects automatically; no hard-coded port needed.
macOS print stack
Same pipeline as Windows / Linux; only the output stage differs:
- Browser calls
printHtml→ npm submits via local WebSocket - Client Chromium engine renders HTML → PDF
- Job sent via CUPS to printers added in System Settings → Printers & Scanners
If a printer is missing, add it in macOS system settings first, then refresh the list in the client.
Troubleshooting
| 现象 | 处理建议 |
|---|---|
| npm connection failed | Ensure the client is running; check firewall rules for localhost |
| Missing CJK glyphs in PDF | Set common CJK fonts in HTML or install fonts on the Mac |
| Print does nothing | Print a test page in system settings; verify printerName matches the CUPS queue name |
| Mixed office environment | Share one web-print-pdf codebase; install the matching client per OS |
Deployment notes
- One front-end codebase across macOS, Windows, and Linux—ideal when design teams use Mac and production runs on Win/Linux.
- Works offline on intranet; PDF generation is local.
- Use the built-in Run examples page in the client to debug APIs and printer lists on Mac.
- macOS clients support updates with the same policy as Windows / Linux.