Live demos
Browse the sample list on the left and preview layouts plus sample code on the right. Run a demo to print silently or preview PDF via web-print-pdf and the local client. Install and launch the client first.
Client
If results look wrong, install the latest Web Print Expert client from our site first (older builds may cause layout drift).
Layout
Preview and print follow standard HTML/CSS only—no hidden tricks. What you style is what you get.
02 - Full HTML document
Pass a full HTML string with html, head, and style tags—styles live in the document.
Layout preview
Sample code
const html = `<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<style>
body { font-family: "Microsoft YaHei", sans-serif; padding: 24px; }
h1 { color: #005AAC; }
.card { background: #f7fafc; padding: 16px; border-radius: 8px; }
</style>
</head>
<body>
<h1>Web打印专家</h1>
<div class="card">完整 HTML 文档,样式在 <style> 中定义。</div>
</body>
</html>`;
await webPrintPdf.printHtml(html, {
paperFormat: 'A4',
printBackground: true,
margin: { top: '15mm', bottom: '15mm' }
}, {
paperFormat: 'A4'
});
Result
- Demos load bundled
web-print-pdffirst (same API as npm); CDN is used as fallback. - The client’s built-in Run examples page has more editable demos; this page complements it.
- Utility demos (connection, printer list) return JSON only—no print job.