在线样例
左侧浏览样例目录,右侧查看版式预览与示例代码;点击运行即可通过 web-print-pdf 驱动本地客户端完成静默打印或 PDF 预览。使用前请先 安装并启动客户端。
客户端
若打印或预览效果与预期不符,请务必先从官网下载并安装最新版 Web打印专家客户端后再试(旧版本可能导致版式偏差)。
版式说明
版式预览与打印输出完全遵循 HTML/CSS 标准样式,没有隐藏的渲染技巧:样式写成什么样,页面就长成什么样。
67 - 班级考勤表
班级考勤表打印样例。
版式预览
示例代码
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:48px;top:50px;width:300px;height:14px;box-sizing:border-box;overflow:hidden;font-size:8px;font-weight:700;color:#059669;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">ATTENDANCE</div>
<div style="position:absolute;left:546px;top:60px;width:200px;height:56px;box-sizing:border-box;overflow:hidden;background:#ECFDF5"></div>
<div style="position:absolute;left:48px;top:68px;width:400px;height:36px;box-sizing:border-box;overflow:hidden;font-size:23px;font-weight:700;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">班级考勤表</div>
<div style="position:absolute;left:620px;top:68px;width:112px;height:18px;box-sizing:border-box;overflow:hidden;font-size:9.5px;font-weight:700;color:#0F172A;text-align:right;display:flex;align-items:center;justify-content:flex-end;white-space:pre-wrap">高二(3)班</div>
<div style="position:absolute;left:560px;top:70px;width:60px;height:14px;box-sizing:border-box;overflow:hidden;font-size:7.5px;color:#047857;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">班级</div>
<div style="position:absolute;left:620px;top:92px;width:112px;height:18px;box-sizing:border-box;overflow:hidden;font-size:9.5px;font-weight:700;color:#0F172A;text-align:right;display:flex;align-items:center;justify-content:flex-end;white-space:pre-wrap">第 9 周</div>
<div style="position:absolute;left:560px;top:94px;width:60px;height:14px;box-sizing:border-box;overflow:hidden;font-size:7.5px;color:#047857;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">周次</div>
<div style="position:absolute;left:48px;top:108px;width:400px;height:14px;box-sizing:border-box;overflow:hidden;font-size:8px;color:#94A3B8;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">CLASS ATTENDANCE SHEET</div>
<div style="position:absolute;left:112px;top:137px;width:160px;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:444px;top:137px;width:160px;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">2026-10-27</div>
<div style="position:absolute;left:48px;top:140px;width:60px;height:16px;box-sizing:border-box;overflow:hidden;font-size:8.5px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">统计人</div>
<div style="position:absolute;left:380px;top:140px;width:60px;height:16px;box-sizing:border-box;overflow:hidden;font-size:8.5px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">统计日期</div>
<div style="position:absolute;left:112px;top:159px;width:160px;height:1px;box-sizing:border-box;overflow:hidden;background:#CBD5E1"></div>
<div style="position:absolute;left:444px;top:159px;width:160px;height:1px;box-sizing:border-box;overflow:hidden;background:#CBD5E1"></div>
<div style="position:absolute;left:48px;top:194px;width:214px;height:76px;box-sizing:border-box;overflow:hidden;background:#ECFDF5"></div>
<div style="position:absolute;left:290px;top:194px;width:214px;height:76px;box-sizing:border-box;overflow:hidden;background:#FFFBEB"></div>
<div style="position:absolute;left:532px;top:194px;width:214px;height:76px;box-sizing:border-box;overflow:hidden;background:#FEF2F2"></div>
<div style="position:absolute;left:64px;top:206px;width:180px;height:14px;box-sizing:border-box;overflow:hidden;font-size:8px;color:#047857;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">本周出勤人次</div>
<div style="position:absolute;left:306px;top:206px;width:180px;height:14px;box-sizing:border-box;overflow:hidden;font-size:8px;color:#B45309;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">请假人次</div>
<div style="position:absolute;left:548px;top:206px;width:180px;height:14px;box-sizing:border-box;overflow:hidden;font-size:8px;color:#B91C1C;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">旷课人次</div>
<div style="position:absolute;left:64px;top:226px;width:180px;height:34px;box-sizing:border-box;overflow:hidden;font-size:26px;font-weight:700;color:#059669;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">28</div>
<div style="position:absolute;left:306px;top:226px;width:180px;height:34px;box-sizing:border-box;overflow:hidden;font-size:26px;font-weight:700;color:#D97706;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">2</div>
<div style="position:absolute;left:548px;top:226px;width:180px;height:34px;box-sizing:border-box;overflow:hidden;font-size:26px;font-weight:700;color:#DC2626;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">2</div>
<div style="position:absolute;left:48px;top:302px;width:698px;height:564px;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:28.6533%;box-sizing:border-box;border:1px solid #E2E8F0;padding:0 6px;height:36px;background:#ECFDF5;color:#047857;font-size:9.5px;font-weight:600;text-align:left">学生姓名</th><th style="width:12.8940%;box-sizing:border-box;border:1px solid #E2E8F0;padding:0 6px;height:36px;background:#ECFDF5;color:#047857;fo
// …
运行结果
- 若无法打印或连接客户端失败,请参阅 本地Print succeeded,上线后无法打印?(HTTP 业务系统上线后常见)。
- 客户端内置「运行示例」页(
vueApp/.../examples/index.vue)提供更多可编辑 demo,与本页样例互补。 - 工具类样例(连接检测、打印机列表等)仅返回 JSON,不触发打印。