在线样例
左侧浏览样例目录,右侧查看版式预览与示例代码;点击运行即可通过 web-print-pdf 驱动本地客户端完成静默打印或 PDF 预览。使用前请先 安装并启动客户端。
客户端
若打印或预览效果与预期不符,请务必先从官网下载并安装最新版 Web打印专家客户端后再试(旧版本可能导致版式偏差)。
版式说明
版式预览与打印输出完全遵循 HTML/CSS 标准样式,没有隐藏的渲染技巧:样式写成什么样,页面就长成什么样。
14 - 京东物流面单
京东物流面单打印样例。
版式预览
示例代码
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:44px;box-sizing:border-box;overflow:hidden;background:#111827"></div>
<div style="position:absolute;left:12px;top:9px;width:200px;height:26px;box-sizing:border-box;overflow:hidden;font-size:13px;font-weight:700;color:#FFFFFF;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">京东物流 JD LOGISTICS</div>
<div style="position:absolute;left:250px;top:13px;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">950616</div>
<div style="position:absolute;left:52px;top:50px;width:200px;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">JDVA12345678901</div>
<div style="position:absolute;left:12px;top:52px;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:12px;top:76px;width:354px;height:56px;box-sizing:border-box;overflow:hidden;display:flex;flex-direction:column;align-items:center;justify-content:center"><svg width="354" height="46" viewBox="0 0 354 46" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none"><rect x="0" y="0" width="3" height="46" fill="#111"/><rect x="6" y="0" width="3" height="46" fill="#111"/><rect x="12" y="0" width="2" height="46" fill="#111"/><rect x="17" y="0" width="1" height="46" fill="#111"/><rect x="20" y="0" width="3" height="46" fill="#111"/><rect x="24" y="0" width="2" height="46" fill="#111"/><rect x="29" y="0" width="1" height="46" fill="#111"/><rect x="31" y="0" width="2" height="46" fill="#111"/><rect x="36" y="0" width="3" height="46" fill="#111"/><rect x="42" y="0" width="3" height="46" fill="#111"/><rect x="47" y="0" width="3" height="46" fill="#111"/><rect x="51" y="0" width="2" height="46" fill="#111"/><rect x="56" y="0" width="1" height="46" fill="#111"/><rect x="59" y="0" width="3" height="46" fill="#111"/><rect x="63" y="0" width="1" height="46" fill="#111"/><rect x="66" y="0" width="3" height="46" fill="#111"/><rect x="72" y="0" width="3" height="46" fill="#111"/><rect x="78" y="0" width="2" height="46" fill="#111"/><rect x="83" y="0" width="1" height="46" fill="#111"/><rect x="86" y="0" width="3" height="46" fill="#111"/><rect x="90" y="0" width="2" height="46" fill="#111"/><rect x="95" y="0" width="1" height="46" fill="#111"/><rect x="97" y="0" width="2" height="46" fill="#111"/><rect x="102" y="0" width="3" height="46" fill="#111"/><rect x="108" y="0" width="3" height="46" fill="#111"/><rect x="113" y="0" width="3" height="46" fill="#111"/><rect x="117" y="0" width="2" height="46" fill="#111"/><rect x="122" y="0" width="1" height="46" fill="#111"/><rect x="125" y="0" width="3" height="46" fill="#111"/><rect x="129" y="0" width="1" height="46" fill="#111"/><rect x="132" y="0" width="3" height="46" fill="#111"/><rect x="138" y="0" width="3" height="46" fill="#111"/><rect x="144" y="0" width="2" height="46" fill="#111"/><rect x="149" y="0" width="1" height="46" fill="#111"/><rect x="152" y="0" width="3" height="46" fill="#111"/><rect x="156" y="0" width="2" height="46" fill="#111"/><rect x="161" y="0" width="1" height="46" fill="#111"/><rect x="163" y="0" width="2" height="46" fill="#111"/><rect x="168" y="0" width="3" height="46" fill="#111"/><rect x="174" y="0" width="3" height="46" fill="#111"/><rect x="179" y="0" width="3" height="46" fill="#111"/><rect x="183" y="0" width="2" height="46" fill="#111"/><rect x="188" y="0" width="1" height="46" fill="#111"/><rect x="191" y="0" width="3" height="46" fill="#111"/><rect x="195" y="0" width="1" height="46" fill="#111"/><rect x="198" y="0" width="3" height="46" fill="#111"/><rect x="204" y="0" width="3" height="46" fill="#111"/><rect x="210" y="0" width="2" height="46" fill="#111"/><rect x="215" y="0" width="1" height="46" fill="#111"/><rect x="218" y="0" width="3" height="46" fill="#111"/><rect x="222" y="0" width="2" height="46" fill="#111"/><rect x="227" y="0" width="1" height="46" fill="#111"/><rect x="229" y="0" width="2" height="46" fill="#111"/><rect x="234" y="0" width="3" height="46" fill="#111"/><rect x="240" y="0" width="3" height="46" fill="#111"/><rect x="245" y="0" width="3" height="46" fill="#111"/><rect x="249" y="0" width="2" height="46" fill="#111"/><rect x="254" y="0" width="1" height="46" fill="#111"/><rect x="257" y="0" width="3" height="46" fill="#111"/><rect x="261" y="0" width="1" height="46" fill="#111"/><rect x="264" y="0" width="3" height="46" fill="#111"/><rect x="270" y="0" width="3" height="46" fill="#111"/><rect x="276" y="0" width="2" height="46" fill="#111"/><rect x="281" y="0" width="1" height="46" fill="#111"/><rect x="284" y="0" width="3" height="46" fill="#111"/><rect x="288" y="0" width="2" height="46" fill="#111"/><rect x="293" y="0" width="1" height="46" fill="#111"/><rect x="295" y="0" width="2" height="46" fill="#111"/><rect x="300" y="0" width="3" height="46" fill="#111"/><rect x="306" y="0" width="3" height="46" fill="#111"/><rect x="311" y="0" width="3" height="46" fill="#111"/><rect x="315" y="0" width="2" height="46" fill="#111"/><rect x="320" y="0" width="1" height="46" fill="#111"/><rect x="323" y="0" width="3" height="46" fill="#111"/><rect x="327" y="0" width="1" height="4
// …
运行结果
- 若无法打印或连接客户端失败,请参阅 本地Print succeeded,上线后无法打印?(HTTP 业务系统上线后常见)。
- 客户端内置「运行示例」页(
vueApp/.../examples/index.vue)提供更多可编辑 demo,与本页样例互补。 - 工具类样例(连接检测、打印机列表等)仅返回 JSON,不触发打印。