在线样例
左侧浏览样例目录,右侧查看版式预览与示例代码;点击运行即可通过 web-print-pdf 驱动本地客户端完成静默打印或 PDF 预览。使用前请先 安装并启动客户端。
客户端
若打印或预览效果与预期不符,请务必先从官网下载并安装最新版 Web打印专家客户端后再试(旧版本可能导致版式偏差)。
版式说明
版式预览与打印输出完全遵循 HTML/CSS 标准样式,没有隐藏的渲染技巧:样式写成什么样,页面就长成什么样。
12 - 中通快递面单
中通快递面单打印样例。
版式预览
示例代码
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: 378px;
height: 567px;
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:378px;height:46px;box-sizing:border-box;overflow:hidden;background:#1B5FAA"></div>
<div style="position:absolute;left:12px;top:10px;width:180px;height:26px;box-sizing:border-box;overflow:hidden;font-size:15px;font-weight:700;color:#FFFFFF;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">中通快递 ZTO</div>
<div style="position:absolute;left:250px;top:14px;width:116px;height:18px;box-sizing:border-box;overflow:hidden;font-size:12px;font-weight:700;color:#FFFFFF;text-align:right;display:flex;align-items:center;justify-content:flex-end;white-space:pre-wrap">95311</div>
<div style="position:absolute;left:52px;top:52px;width:180px;height:18px;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">ZT781234567890</div>
<div style="position:absolute;left:286px;top:52px;width:80px;height:18px;box-sizing:border-box;overflow:hidden;font-size:13px;font-weight:700;color:#0F172A;text-align:right;display:flex;align-items:center;justify-content:flex-end;white-space:pre-wrap">021</div>
<div style="position:absolute;left:12px;top:54px;width:36px;height:12px;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:240px;top:54px;width:40px;height:12px;box-sizing:border-box;overflow:hidden;font-size:8px;color:#64748B;text-align:right;display:flex;align-items:center;justify-content:flex-end;white-space:pre-wrap">目的地</div>
<div style="position:absolute;left:12px;top:78px;width:354px;height:54px;box-sizing:border-box;overflow:hidden;display:flex;flex-direction:column;align-items:center;justify-content:center"><svg width="354" height="44" viewBox="0 0 354 44" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none"><rect x="0" y="0" width="1" height="44" fill="#111"/><rect x="2" y="0" width="2" height="44" fill="#111"/><rect x="7" y="0" width="2" height="44" fill="#111"/><rect x="12" y="0" width="1" height="44" fill="#111"/><rect x="15" y="0" width="3" height="44" fill="#111"/><rect x="19" y="0" width="2" height="44" fill="#111"/><rect x="24" y="0" width="1" height="44" fill="#111"/><rect x="26" y="0" width="1" height="44" fill="#111"/><rect x="28" y="0" width="2" height="44" fill="#111"/><rect x="33" y="0" width="2" height="44" fill="#111"/><rect x="38" y="0" width="1" height="44" fill="#111"/><rect x="41" y="0" width="3" height="44" fill="#111"/><rect x="45" y="0" width="2" height="44" fill="#111"/><rect x="50" y="0" width="1" height="44" fill="#111"/><rect x="52" y="0" width="1" height="44" fill="#111"/><rect x="54" y="0" width="2" height="44" fill="#111"/><rect x="59" y="0" width="2" height="44" fill="#111"/><rect x="64" y="0" width="1" height="44" fill="#111"/><rect x="67" y="0" width="3" height="44" fill="#111"/><rect x="71" y="0" width="2" height="44" fill="#111"/><rect x="76" y="0" width="1" height="44" fill="#111"/><rect x="78" y="0" width="1" height="44" fill="#111"/><rect x="80" y="0" width="2" height="44" fill="#111"/><rect x="85" y="0" width="2" height="44" fill="#111"/><rect x="90" y="0" width="1" height="44" fill="#111"/><rect x="93" y="0" width="3" height="44" fill="#111"/><rect x="97" y="0" width="2" height="44" fill="#111"/><rect x="102" y="0" width="1" height="44" fill="#111"/><rect x="104" y="0" width="1" height="44" fill="#111"/><rect x="106" y="0" width="2" height="44" fill="#111"/><rect x="111" y="0" width="2" height="44" fill="#111"/><rect x="116" y="0" width="1" height="44" fill="#111"/><rect x="119" y="0" width="3" height="44" fill="#111"/><rect x="123" y="0" width="2" height="44" fill="#111"/><rect x="128" y="0" width="1" height="44" fill="#111"/><rect x="130" y="0" width="1" height="44" fill="#111"/><rect x="132" y="0" width="2" height="44" fill="#111"/><rect x="137" y="0" width="2" height="44" fill="#111"/><rect x="142" y="0" width="1" height="44" fill="#111"/><rect x="145" y="0" width="3" height="44" fill="#111"/><rect x="149" y="0" width="2" height="44" fill="#111"/><rect x="154" y="0" width="1" height="44" fill="#111"/><rect x="156" y="0" width="1" height="44" fill="#111"/><rect x="158" y="0" width="2" height="44" fill="#111"/><rect x="163" y="0" width="2" height="44" fill="#111"/><rect x="168" y="0" width="1" height="44" fill="#111"/><rect x="171" y="0" width="3" height="44" fill="#111"/><rect x="175" y="0" width="2" height="44" fill="#111"/><rect x="180" y="0" width="1" height="44" fill="#111"/><rect x="182" y="0" width="1" height="44" fill="#111"/><rect x="184" y="0" width="2" height="44" fill="#111"/><rect x="189" y="0" width="2" height="44" fill="#111"/><rect x="194" y="0" width="1" height="44" fill="#111"/><rect x="197" y="0" width="3" height="44" fill="#111"/><rect x="201" y="0" width="2" height="44" fill="#111"/><rect x="206" y="0" width="1" height="44" fill="#111"/><rect x="208" y="0" width="1" height="44" fill="#111"/><rect x="210" y="0" width="2" height="44" fill="#111"/><rect x="215" y="0" width="2" height="44" fill="#111"/><rect x="220" y="0" width="1" height="44" fill="#111"/><rect x="223" y="0" width="3" height="44" fill="#111"/><rect x="227" y="0" width="2" height="44" fill="#111"/><rect x="232" y="0" width="1" height="44" fill="#111"/><rect x="234" y="0" width="1" height="44" fill="#111"/><rect x="236" y="0" width="2" height="44" fill="#111"/><rect x="241" y="0" width="2" height="44"
// …
运行结果
- 若无法打印或连接客户端失败,请参阅 本地Print succeeded,上线后无法打印?(HTTP 业务系统上线后常见)。
- 客户端内置「运行示例」页(
vueApp/.../examples/index.vue)提供更多可编辑 demo,与本页样例互补。 - 工具类样例(连接检测、打印机列表等)仅返回 JSON,不触发打印。