在线样例
左侧浏览样例目录,右侧查看版式预览与示例代码;点击运行即可通过 web-print-pdf 驱动本地客户端完成静默打印或 PDF 预览。使用前请先 安装并启动客户端。
客户端
若打印或预览效果与预期不符,请务必先从官网下载并安装最新版 Web打印专家客户端后再试(旧版本可能导致版式偏差)。
版式说明
版式预览与打印输出完全遵循 HTML/CSS 标准样式,没有隐藏的渲染技巧:样式写成什么样,页面就长成什么样。
60 - 检验报告单
检验报告单打印样例。
版式预览
示例代码
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:546px;top:48px;width:200px;height:48px;box-sizing:border-box;overflow:hidden;display:flex;flex-direction:column;align-items:center;justify-content:center"><svg width="200" height="34" viewBox="0 0 200 34" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none"><rect x="0" y="0" width="2" height="34" fill="#111"/><rect x="3" y="0" width="3" height="34" fill="#111"/><rect x="7" y="0" width="3" height="34" fill="#111"/><rect x="11" y="0" width="2" height="34" fill="#111"/><rect x="14" y="0" width="3" height="34" fill="#111"/><rect x="19" y="0" width="1" height="34" fill="#111"/><rect x="22" y="0" width="3" height="34" fill="#111"/><rect x="27" y="0" width="1" height="34" fill="#111"/><rect x="31" y="0" width="1" height="34" fill="#111"/><rect x="35" y="0" width="1" height="34" fill="#111"/><rect x="38" y="0" width="1" height="34" fill="#111"/><rect x="42" y="0" width="2" height="34" fill="#111"/><rect x="45" y="0" width="2" height="34" fill="#111"/><rect x="50" y="0" width="2" height="34" fill="#111"/><rect x="53" y="0" width="3" height="34" fill="#111"/><rect x="57" y="0" width="3" height="34" fill="#111"/><rect x="61" y="0" width="2" height="34" fill="#111"/><rect x="64" y="0" width="3" height="34" fill="#111"/><rect x="69" y="0" width="1" height="34" fill="#111"/><rect x="72" y="0" width="3" height="34" fill="#111"/><rect x="77" y="0" width="1" height="34" fill="#111"/><rect x="81" y="0" width="1" height="34" fill="#111"/><rect x="85" y="0" width="1" height="34" fill="#111"/><rect x="88" y="0" width="1" height="34" fill="#111"/><rect x="92" y="0" width="2" height="34" fill="#111"/><rect x="95" y="0" width="2" height="34" fill="#111"/><rect x="100" y="0" width="2" height="34" fill="#111"/><rect x="103" y="0" width="3" height="34" fill="#111"/><rect x="107" y="0" width="3" height="34" fill="#111"/><rect x="111" y="0" width="2" height="34" fill="#111"/><rect x="114" y="0" width="3" height="34" fill="#111"/><rect x="119" y="0" width="1" height="34" fill="#111"/><rect x="122" y="0" width="3" height="34" fill="#111"/><rect x="127" y="0" width="1" height="34" fill="#111"/><rect x="131" y="0" width="1" height="34" fill="#111"/><rect x="135" y="0" width="1" height="34" fill="#111"/><rect x="138" y="0" width="1" height="34" fill="#111"/><rect x="142" y="0" width="2" height="34" fill="#111"/><rect x="145" y="0" width="2" height="34" fill="#111"/><rect x="150" y="0" width="2" height="34" fill="#111"/><rect x="153" y="0" width="3" height="34" fill="#111"/><rect x="157" y="0" width="3" height="34" fill="#111"/><rect x="161" y="0" width="2" height="34" fill="#111"/><rect x="164" y="0" width="3" height="34" fill="#111"/><rect x="169" y="0" width="1" height="34" fill="#111"/><rect x="172" y="0" width="3" height="34" fill="#111"/><rect x="177" y="0" width="1" height="34" fill="#111"/><rect x="181" y="0" width="1" height="34" fill="#111"/><rect x="185" y="0" width="1" height="34" fill="#111"/><rect x="188" y="0" width="1" height="34" fill="#111"/><rect x="192" y="0" width="2" height="34" fill="#111"/><rect x="195" y="0" width="2" height="34" fill="#111"/></svg><div style="text-align:center;font-size:7px;line-height:1.2;margin-top:1px">LB20261027018</div></div>
<div style="position:absolute;left:48px;top:50px;width:360px;height:16px;box-sizing:border-box;overflow:hidden;font-size:9px;font-weight:700;color:#0284C7;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">市第一人民医院 · 检验科</div>
<div style="position:absolute;left:48px;top:70px;width:360px;height:34px;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:48px;top:108px;width:360px;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">LABORATORY TEST REPORT</div>
<div style="position:absolute;left:48px;top:138px;width:698px;height:2px;box-sizing:border-box;overflow:hidden;background:#0284C7"></div>
<div style="position:absolute;left:48px;top:152px;width:698px;height:76px;box-sizing:border-box;overflow:hidden;background:#F0F9FF"></div>
<div style="position:absolute;left:104px;top:160px;width:118px;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:288px;top:160px;width:60px;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:422px;top:160px;width:70px;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">52 岁</div>
<div style="position:absolute;left:578px;top:160px;width:90px;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:62px;top:162px;width:40px;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:246px;top:162px;width:40px;height:14
// …
运行结果
- 若无法打印或连接客户端失败,请参阅 本地Print succeeded,上线后无法打印?(HTTP 业务系统上线后常见)。
- 客户端内置「运行示例」页(
vueApp/.../examples/index.vue)提供更多可编辑 demo,与本页样例互补。 - 工具类样例(连接检测、打印机列表等)仅返回 JSON,不触发打印。