在线样例
左侧浏览样例目录,右侧查看版式预览与示例代码;点击运行即可通过 web-print-pdf 驱动本地客户端完成静默打印或 PDF 预览。使用前请先 安装并启动客户端。
客户端
若打印或预览效果与预期不符,请务必先从官网下载并安装最新版 Web打印专家客户端后再试(旧版本可能导致版式偏差)。
版式说明
版式预览与打印输出完全遵循 HTML/CSS 标准样式,没有隐藏的渲染技巧:样式写成什么样,页面就长成什么样。
64 - 就诊卡
就诊卡打印样例。
版式预览
示例代码
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: 204px;
height: 325px;
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:0px;top:0px;width:204px;height:72px;box-sizing:border-box;overflow:hidden;background:#0E7490"></div>
<div style="position:absolute;left:12px;top:12px;width:180px;height:14px;box-sizing:border-box;overflow:hidden;font-size:8px;color:#A5F3FC;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">市第一人民医院</div>
<div style="position:absolute;left:12px;top:30px;width:180px;height:28px;box-sizing:border-box;overflow:hidden;font-size:16px;font-weight:700;color:#FFFFFF;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">就 诊 卡</div>
<div style="position:absolute;left:12px;top:58px;width:180px;height:10px;box-sizing:border-box;overflow:hidden;font-size:6px;color:#67E8F9;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">PATIENT CARD</div>
<div style="position:absolute;left:12px;top:82px;width:60px;height:12px;box-sizing:border-box;overflow:hidden;font-size:6.5px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">卡号</div>
<div style="position:absolute;left:12px;top:94px;width:180px;height:18px;box-sizing:border-box;overflow:hidden;font-size:10px;font-weight:700;color:#0E7490;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">8801 2267 5589</div>
<div style="position:absolute;left:12px;top:112px;width:180px;height:1px;box-sizing:border-box;overflow:hidden;background:#A5F3FC"></div>
<div style="position:absolute;left:60px;top:119px;width:132px;height:14px;box-sizing:border-box;overflow:hidden;font-size:8.5px;font-weight:600;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">周雅琴</div>
<div style="position:absolute;left:12px;top:120px;width:44px;height:12px;box-sizing:border-box;overflow:hidden;font-size:6.5px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">姓名</div>
<div style="position:absolute;left:60px;top:139px;width:132px;height:14px;box-sizing:border-box;overflow:hidden;font-size:8.5px;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">呼吸内科</div>
<div style="position:absolute;left:12px;top:140px;width:44px;height:12px;box-sizing:border-box;overflow:hidden;font-size:6.5px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">常诊科室</div>
<div style="position:absolute;left:60px;top:159px;width:132px;height:14px;box-sizing:border-box;overflow:hidden;font-size:8.5px;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">2030-12-31</div>
<div style="position:absolute;left:12px;top:160px;width:44px;height:12px;box-sizing:border-box;overflow:hidden;font-size:6.5px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">有效期</div>
<div style="position:absolute;left:12px;top:186px;width:64px;height:64px;box-sizing:border-box;overflow:hidden;display:flex;align-items:center;justify-content:center"><svg width="64" height="64" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><rect x="0.00" y="0.00" width="5.82" height="5.82" fill="#111"/><rect x="5.82" y="0.00" width="5.82" height="5.82" fill="#111"/><rect x="11.64" y="0.00" width="5.82" height="5.82" fill="#111"/><rect x="17.45" y="0.00" width="5.82" height="5.82" fill="#111"/><rect x="29.09" y="0.00" width="5.82" height="5.82" fill="#111"/><rect x="46.55" y="0.00" width="5.82" height="5.82" fill="#111"/><rect x="52.36" y="0.00" width="5.82" height="5.82" fill="#111"/><rect x="58.18" y="0.00" width="5.82" height="5.82" fill="#111"/><rect x="0.00" y="5.82" width="5.82" height="5.82" fill="#111"/><rect x="5.82" y="5.82" width="5.82" height="5.82" fill="#111"/><rect x="11.64" y="5.82" width="5.82" height="5.82" fill="#111"/><rect x="23.27" y="5.82" width="5.82" height="5.82" fill="#111"/><rect x="34.91" y="5.82" width="5.82" height="5.82" fill="#111"/><rect x="46.55" y="5.82" width="5.82" height="5.82" fill="#111"/><rect x="52.36" y="5.82" width="5.82" height="5.82" fill="#111"/><rect x="58.18" y="5.82" width="5.82" height="5.82" fill="#111"/><rect x="0.00" y="11.64" width="5.82" height="5.82" fill="#111"/><rect x="5.82" y="11.64" width="5.82" height="5.82" fill="#111"/><rect x="11.64" y="11.64" width="5.82" height="5.82" fill="#111"/><rect x="29.09" y="11.64" width="5.82" height="5.82" fill="#111"/><rect x="40.73" y="11.64" width="5.82" height="5.82" fill="#111"/><rect x="46.55" y="11.64" width="5.82" height="5.82" fill="#111"/><rect x="52.36" y="11.64" width="5.82" height="5.82" fill="#111"/><rect x="58.18" y="11.64" width="5.82" height="5.82" fill="#111"/><rect x="5.82" y="17.45" width="5.82" height="5.82" fill="#111"/><rect x="17.45" y="17.45" width="5.82" height="5.82" fill="#111"/><rect x="34.91" y="17.45" width="5.82" height="5.82" fill="#111"/><rect x="46.55" y="17.45" width="5.82" height="5.82" fill="#111"/><rect x="11.64" y="23.27" width="5.82" height="5.82" fill="#111"/><rect x="23.27" y="23.27" width="5.82" height="5.82" fill="#111"/><rect x="40.73" y="23.27" width="5.82" height="5.82" fill="#111"/><rect x="52.36" y="23.27" width="5.82" height="5.82" fill="#111"/><rect x="0.00" y="29.09" width="5.82" height="5.82" fill="#111"/><rect x="17.45" y="29.09" width="5.82" height="5.82" fill="#111"/><rect x="29.09" y="29.09" width="5.82" height="5.82" fill="#111"/><rect x="46.55" y="29.09" width="5.82" height="5.82" fill="#111"/><rect x="58.18" y="29.09" width="
// …
运行结果
- 若无法打印或连接客户端失败,请参阅 本地Print succeeded,上线后无法打印?(HTTP 业务系统上线后常见)。
- 客户端内置「运行示例」页(
vueApp/.../examples/index.vue)提供更多可编辑 demo,与本页样例互补。 - 工具类样例(连接检测、打印机列表等)仅返回 JSON,不触发打印。