在线样例
左侧浏览样例目录,右侧查看版式预览与示例代码;点击运行即可通过 web-print-pdf 驱动本地客户端完成静默打印或 PDF 预览。使用前请先 安装并启动客户端。
客户端
若打印或预览效果与预期不符,请务必先从官网下载并安装最新版 Web打印专家客户端后再试(旧版本可能导致版式偏差)。
版式说明
版式预览与打印输出完全遵循 HTML/CSS 标准样式,没有隐藏的渲染技巧:样式写成什么样,页面就长成什么样。
11 - 顺丰标准快递面单
顺丰标准快递面单打印样例。
版式预览
示例代码
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:240px;top:6px;width:126px;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">95338</div>
<div style="position:absolute;left:12px;top:8px;width:26px;height:26px;box-sizing:border-box;overflow:hidden;background:#111827;border:1px solid #111827;box-sizing:border-box"></div>
<div style="position:absolute;left:12px;top:8px;width:26px;height:26px;box-sizing:border-box;overflow:hidden;font-size:11px;font-weight:700;color:#FFFFFF;text-align:center;display:flex;align-items:center;justify-content:center;white-space:pre-wrap">SF</div>
<div style="position:absolute;left:44px;top:9px;width:90px;height:14px;box-sizing:border-box;overflow:hidden;font-size:11px;font-weight:700;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">顺丰速运</div>
<div style="position:absolute;left:44px;top:23px;width:90px;height:12px;box-sizing:border-box;overflow:hidden;font-size:7px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">EXPRESS</div>
<div style="position:absolute;left:240px;top:24px;width:126px;height:11px;box-sizing:border-box;overflow:hidden;font-size:7px;color:#64748B;text-align:right;display:flex;align-items:center;justify-content:flex-end;white-space:pre-wrap">www.sf-express.com</div>
<div style="position:absolute;left:12px;top:40px;width:354px;height:1px;box-sizing:border-box;overflow:hidden;background:#CBD5E1"></div>
<div style="position:absolute;left:238px;top:42px;width:80px;height:14px;box-sizing:border-box;overflow:hidden;font-size:10px;font-weight:700;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">顺丰标快</div>
<div style="position:absolute;left:12px;top:44px;width:206px;height:48px;box-sizing:border-box;overflow:hidden;display:flex;flex-direction:column;align-items:center;justify-content:center"><svg width="206" height="44" viewBox="0 0 206 44" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none"><rect x="0" y="0" width="3" height="44" fill="#111"/><rect x="5" y="0" width="3" height="44" fill="#111"/><rect x="11" y="0" width="2" height="44" fill="#111"/><rect x="16" y="0" width="3" height="44" fill="#111"/><rect x="21" y="0" width="2" height="44" fill="#111"/><rect x="25" y="0" width="3" height="44" fill="#111"/><rect x="30" y="0" width="1" height="44" fill="#111"/><rect x="33" y="0" width="3" height="44" fill="#111"/><rect x="38" y="0" width="3" height="44" fill="#111"/><rect x="44" y="0" width="2" height="44" fill="#111"/><rect x="49" y="0" width="3" height="44" fill="#111"/><rect x="54" y="0" width="2" height="44" fill="#111"/><rect x="58" y="0" width="3" height="44" fill="#111"/><rect x="63" y="0" width="1" height="44" fill="#111"/><rect x="66" y="0" width="3" height="44" fill="#111"/><rect x="71" y="0" width="3" height="44" fill="#111"/><rect x="77" y="0" width="2" height="44" fill="#111"/><rect x="82" y="0" width="3" height="44" fill="#111"/><rect x="87" y="0" width="2" height="44" fill="#111"/><rect x="91" y="0" width="3" height="44" fill="#111"/><rect x="96" y="0" width="1" height="44" fill="#111"/><rect x="99" y="0" width="3" height="44" fill="#111"/><rect x="104" y="0" width="3" height="44" fill="#111"/><rect x="110" y="0" width="2" height="44" fill="#111"/><rect x="115" y="0" width="3" height="44" fill="#111"/><rect x="120" y="0" width="2" height="44" fill="#111"/><rect x="124" y="0" width="3" height="44" fill="#111"/><rect x="129" y="0" width="1" height="44" fill="#111"/><rect x="132" y="0" width="3" height="44" fill="#111"/><rect x="137" y="0" width="3" height="44" fill="#111"/><rect x="143" y="0" width="2" height="44" fill="#111"/><rect x="148" y="0" width="3" height="44" fill="#111"/><rect x="153" y="0" width="2" height="44" fill="#111"/><rect x="157" y="0" width="3" height="44" fill="#111"/><rect x="162" y="0" width="1" height="44" fill="#111"/><rect x="165" y="0" width="3" height="44" fill="#111"/><rect x="170" y="0" width="3" height="44" fill="#111"/><rect x="176" y="0" width="2" height="44" fill="#111"/><rect x="181" y="0" width="3" height="44" fill="#111"/><rect x="186" y="0" width="2" height="44" fill="#111"/><rect x="190" y="0" width="3" height="44" fill="#111"/><rect x="195" y="0" width="1" height="44" fill="#111"/><rect x="198" y="0" width="3" height="44" fill="#111"/><rect x="203" y="0" width="3" height="44" fill="#111"/></svg></div>
<div style="position:absolute;left:228px;top:44px;width:1px;height:64px;box-sizing:border-box;overflow:hidden;background:#CBD5E1"></div>
<div style="position:absolute;left:280px;top:58px;width:86px;height:26px;box-sizing:border-box;overflow:hidden;font-size:20px;font-weight:700;color:#0F172A;text-align:right;display:flex;align-items:center;justify-content:flex-end;white-space:pre-wrap">020</div>
<div style="position:absolute;left:238px;top:60px;width:40px;height:11px;box-sizing:border-box;overflow:hidden;font-size:7px;color:#64748B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">目的地</div>
<div style="position:absolute;left:50px;top:92px;width:168px;height:14px;box-sizing:border-box;overflow:hidden;font-size:10px;font-weight:700;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">SF254227178797</div>
<div style="position:absolute;left:12px;top:94px;width:36px;height:12px;box-sizing:border-box;overflow:hid
// …
运行结果
- 若无法打印或连接客户端失败,请参阅 本地Print succeeded,上线后无法打印?(HTTP 业务系统上线后常见)。
- 客户端内置「运行示例」页(
vueApp/.../examples/index.vue)提供更多可编辑 demo,与本页样例互补。 - 工具类样例(连接检测、打印机列表等)仅返回 JSON,不触发打印。