在线样例
左侧浏览样例目录,右侧查看版式预览与示例代码;点击运行即可通过 web-print-pdf 驱动本地客户端完成静默打印或 PDF 预览。使用前请先 安装并启动客户端。
客户端
若打印或预览效果与预期不符,请务必先从官网下载并安装最新版 Web打印专家客户端后再试(旧版本可能导致版式偏差)。
版式说明
版式预览与打印输出完全遵循 HTML/CSS 标准样式,没有隐藏的渲染技巧:样式写成什么样,页面就长成什么样。
63 - 预防接种记录
预防接种记录打印样例。
版式预览
示例代码
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: 794px;
height: 1123px;
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:794px;height:96px;box-sizing:border-box;overflow:hidden;background:#0E7490"></div>
<div style="position:absolute;left:48px;top:20px;width:400px;height:16px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#A5F3FC;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">城东社区卫生服务中心</div>
<div style="position:absolute;left:540px;top:26px;width:206px;height:14px;box-sizing:border-box;overflow:hidden;font-size:8px;color:#A5F3FC;text-align:right;display:flex;align-items:center;justify-content:flex-end;white-space:pre-wrap">接种证号</div>
<div style="position:absolute;left:48px;top:42px;width:400px;height:34px;box-sizing:border-box;overflow:hidden;font-size:23px;font-weight:700;color:#FFFFFF;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">预防接种记录</div>
<div style="position:absolute;left:540px;top:44px;width:206px;height:20px;box-sizing:border-box;overflow:hidden;font-size:11px;font-weight:700;color:#FFFFFF;text-align:right;display:flex;align-items:center;justify-content:flex-end;white-space:pre-wrap">YF-2021-0316</div>
<div style="position:absolute;left:48px;top:78px;width:400px;height:12px;box-sizing:border-box;overflow:hidden;font-size:8px;color:#67E8F9;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">VACCINATION RECORD</div>
<div style="position:absolute;left:48px;top:112px;width:698px;height:76px;box-sizing:border-box;overflow:hidden;background:#ECFEFF"></div>
<div style="position:absolute;left:114px;top:122px;width:160px;height:18px;box-sizing:border-box;overflow:hidden;font-size:10px;font-weight:600;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">林一诺</div>
<div style="position:absolute;left:394px;top:122px;width:120px;height:18px;box-sizing:border-box;overflow:hidden;font-size:10px;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">2021-03-16</div>
<div style="position:absolute;left:614px;top:122px;width:110px;height:18px;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:62px;top:124px;width:48px;height:14px;box-sizing:border-box;overflow:hidden;font-size:7.5px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">受种者</div>
<div style="position:absolute;left:330px;top:124px;width:60px;height:14px;box-sizing:border-box;overflow:hidden;font-size:7.5px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">出生日期</div>
<div style="position:absolute;left:560px;top:124px;width:50px;height:14px;box-sizing:border-box;overflow:hidden;font-size:7.5px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">监护人</div>
<div style="position:absolute;left:126px;top:150px;width:180px;height:18px;box-sizing:border-box;overflow:hidden;font-size:9.5px;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">137 0000 8899</div>
<div style="position:absolute;left:414px;top:150px;width:100px;height:18px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">5 岁 7 个月</div>
<div style="position:absolute;left:614px;top:150px;width:110px;height:18px;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:62px;top:152px;width:60px;height:14px;box-sizing:border-box;overflow:hidden;font-size:7.5px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">联系电话</div>
<div style="position:absolute;left:350px;top:152px;width:60px;height:14px;box-sizing:border-box;overflow:hidden;font-size:7.5px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">当前年龄</div>
<div style="position:absolute;left:560px;top:152px;width:50px;height:14px;box-sizing:border-box;overflow:hidden;font-size:7.5px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">建档点</div>
<div style="position:absolute;left:48px;top:204px;width:698px;height:40px;box-sizing:border-box;overflow:hidden;background:#F0FDFA"></div>
<div style="position:absolute;left:64px;top:204px;width:666px;height:40px;box-sizing:border-box;overflow:hidden;font-size:8.5px;color:#0E7490;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">免疫规划疫苗由政府免费提供,非免疫规划疫苗知情自愿自费接种</div>
<div style="position:absolute;left:48px;top:262px;width:698px;height:436px;box-sizing:border-box;overflow:hidden;overflow:hidden"><table style="width:100%;max-width:100%;border-collapse:collapse;table-layout:fixed;box-sizing:border-box"><thead><tr><th style="width:25.7880%;box-sizing:border-box;border:1px solid #E2E8F0;padding:0 6px;height:36px;background:#ECFEFF;color:#0E7490;font-size:9px;font-weight:600;text-align:left">疫苗名称</th><th style="width:10.0287%;box-sizing:border-box;border:1px solid #E2E8F0;padding:0 6px;height:36px;background:#ECFEFF;color:#0E7490;font-size:9px;font-weight:600;text-align:center">剂次</th><th style="width:18.6246%;box-sizing:border-box;border:1px solid #E2E8F0;padding:0 6px;height:36px;background:#ECFEFF;color:#0E7490;font-size:9px;font-w
// …
运行结果
- 若无法打印或连接客户端失败,请参阅 本地Print succeeded,上线后无法打印?(HTTP 业务系统上线后常见)。
- 客户端内置「运行示例」页(
vueApp/.../examples/index.vue)提供更多可编辑 demo,与本页样例互补。 - 工具类样例(连接检测、打印机列表等)仅返回 JSON,不触发打印。