在线样例
左侧浏览样例目录,右侧查看版式预览与示例代码;点击运行即可通过 web-print-pdf 驱动本地客户端完成静默打印或 PDF 预览。使用前请先 安装并启动客户端。
客户端
若打印或预览效果与预期不符,请务必先从官网下载并安装最新版 Web打印专家客户端后再试(旧版本可能导致版式偏差)。
版式说明
版式预览与打印输出完全遵循 HTML/CSS 标准样式,没有隐藏的渲染技巧:样式写成什么样,页面就长成什么样。
36 - 通用收据
通用收据打印样例。
版式预览
示例代码
const html = `<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>通用收据</title>
<style>
html, body { margin: 0; padding: 0; }
.biz-sheet {
position: relative;
width: 559px;
height: 397px;
box-sizing: border-box;
background: #fff;
font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
color: #0F172A;
overflow: hidden;
}
</style>
</head>
<body>
<div class="biz-sheet">
<div style="position:absolute;left:12px;top:12px;width:535px;height:373px;box-sizing:border-box;overflow:hidden;border:1px solid #CBD5E1;box-sizing:border-box"></div>
<div style="position:absolute;left:130px;top:26px;width:230px;height:38px;box-sizing:border-box;overflow:hidden;font-size:24px;font-weight:700;color:#0F172A;text-align:center;display:flex;align-items:center;justify-content:center;white-space:pre-wrap">收 据</div>
<div style="position:absolute;left:412px;top:31px;width:122px;height:14px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">SJ20261027001</div>
<div style="position:absolute;left:372px;top:32px;width:40px;height:14px;box-sizing:border-box;overflow:hidden;font-size:8px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">编号</div>
<div style="position:absolute;left:412px;top:49px;width:122px;height:14px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">2026-10-27</div>
<div style="position:absolute;left:372px;top:50px;width:40px;height:14px;box-sizing:border-box;overflow:hidden;font-size:8px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">日期</div>
<div style="position:absolute;left:32px;top:80px;width:495px;height:2px;box-sizing:border-box;overflow:hidden;background:#334155"></div>
<div style="position:absolute;left:124px;top:94px;width:380px;height:24px;box-sizing:border-box;overflow:hidden;font-size:13px;font-weight:700;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">杭州示例商贸有限公司</div>
<div style="position:absolute;left:40px;top:96px;width:80px;height:22px;box-sizing:border-box;overflow:hidden;font-size:10px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">今收到</div>
<div style="position:absolute;left:124px;top:122px;width:380px;height:1px;box-sizing:border-box;overflow:hidden;background:#CBD5E1"></div>
<div style="position:absolute;left:124px;top:134px;width:380px;height:24px;box-sizing:border-box;overflow:hidden;font-size:11px;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">2026 年 9 月画册印刷款</div>
<div style="position:absolute;left:40px;top:136px;width:80px;height:22px;box-sizing:border-box;overflow:hidden;font-size:10px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">交 来</div>
<div style="position:absolute;left:124px;top:162px;width:380px;height:1px;box-sizing:border-box;overflow:hidden;background:#CBD5E1"></div>
<div style="position:absolute;left:152px;top:179px;width:300px;height:24px;box-sizing:border-box;overflow:hidden;font-size:12px;font-weight:700;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">壹万贰仟捌佰陆拾元整</div>
<div style="position:absolute;left:40px;top:182px;width:110px;height:20px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">人民币(大写)</div>
<div style="position:absolute;left:62px;top:210px;width:180px;height:32px;box-sizing:border-box;overflow:hidden;font-size:18px;font-weight:700;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">12,860.00</div>
<div style="position:absolute;left:40px;top:216px;width:20px;height:26px;box-sizing:border-box;overflow:hidden;font-size:12px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">¥</div>
<div style="position:absolute;left:314px;top:216px;width:190px;height:26px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">银行转账</div>
<div style="position:absolute;left:270px;top:218px;width:40px;height:20px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">备注</div>
<div style="position:absolute;left:32px;top:258px;width:495px;height:1px;box-sizing:border-box;overflow:hidden;background:#CBD5E1"></div>
<div style="position:absolute;left:372px;top:268px;width:140px;height:44px;box-sizing:border-box;overflow:hidden;font-size:10px;color:#94A3B8;text-align:center;display:flex;align-items:center;justify-content:center;white-space:pre-wrap">(财务盖章)</div>
<div style="position:absolute;left:132px;top:270px;width:200px;height:20px;box-sizing:border-box;overflow:hidden;font-size:10px;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">杭州云印科技有限公司</div>
<div style="position:absolute;left:40px;top:272px;width:90px;height:18px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">收款单位</div>
<div style="position:absolute;left:40px;top:318px;width:60px;height:18px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">经手人</div>
<div style="position:absolute;left:290px;top:318px;width:40px;height:18px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">日期</div>
<div style="position:absolute;left:102p
// …
运行结果
- 若无法打印或连接客户端失败,请参阅 本地Print succeeded,上线后无法打印?(HTTP 业务系统上线后常见)。
- 客户端内置「运行示例」页(
vueApp/.../examples/index.vue)提供更多可编辑 demo,与本页样例互补。 - 工具类样例(连接检测、打印机列表等)仅返回 JSON,不触发打印。