在线样例
左侧浏览样例目录,右侧查看版式预览与示例代码;点击运行即可通过 web-print-pdf 驱动本地客户端完成静默打印或 PDF 预览。使用前请先 安装并启动客户端。
客户端
若打印或预览效果与预期不符,请务必先从官网下载并安装最新版 Web打印专家客户端后再试(旧版本可能导致版式偏差)。
版式说明
版式预览与打印输出完全遵循 HTML/CSS 标准样式,没有隐藏的渲染技巧:样式写成什么样,页面就长成什么样。
18 - 服装吊牌
服装吊牌打印样例。
版式预览
示例代码
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: 204px;
height: 340px;
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:6px;top:6px;width:192px;height:328px;box-sizing:border-box;overflow:hidden;border:1px solid #CBD5E1;box-sizing:border-box"></div>
<div style="position:absolute;left:20px;top:18px;width:164px;height:24px;box-sizing:border-box;overflow:hidden;font-size:14px;font-weight:700;color:#0F172A;text-align:center;display:flex;align-items:center;justify-content:center;white-space:pre-wrap">云印服饰</div>
<div style="position:absolute;left:20px;top:44px;width:164px;height:12px;box-sizing:border-box;overflow:hidden;font-size:7px;color:#94A3B8;text-align:center;display:flex;align-items:center;justify-content:center;white-space:pre-wrap">YUANYIN APPAREL</div>
<div style="position:absolute;left:20px;top:64px;width:164px;height:1px;box-sizing:border-box;overflow:hidden;background:#CBD5E1"></div>
<div style="position:absolute;left:20px;top:72px;width:164px;height:18px;box-sizing:border-box;overflow:hidden;font-size:10px;font-weight:700;color:#0F172A;text-align:center;display:flex;align-items:center;justify-content:center;white-space:pre-wrap">纯棉圆领短袖 T 恤</div>
<div style="position:absolute;left:64px;top:97px;width:120px;height:14px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">YY-2610</div>
<div style="position:absolute;left:20px;top:98px;width:40px;height:14px;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:64px;top:115px;width:120px;height:14px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">藏青</div>
<div style="position:absolute;left:20px;top:116px;width:40px;height:14px;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:64px;top:133px;width:120px;height:14px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">L(175/92A)</div>
<div style="position:absolute;left:20px;top:134px;width:40px;height:14px;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:64px;top:151px;width:124px;height:32px;box-sizing:border-box;overflow:hidden;font-size:8px;color:#0F172A;white-space:pre-wrap">棉 95% 氨纶 5%</div>
<div style="position:absolute;left:20px;top:152px;width:40px;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:20px;top:188px;width:164px;height:1px;box-sizing:border-box;overflow:hidden;background:#CBD5E1"></div>
<div style="position:absolute;left:62px;top:190px;width:80px;height:22px;box-sizing:border-box;overflow:hidden;font-size:15px;font-weight:700;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">¥ 199.00</div>
<div style="position:absolute;left:20px;top:194px;width:40px;height:16px;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:20px;top:220px;width:164px;height:46px;box-sizing:border-box;overflow:hidden;display:flex;flex-direction:column;align-items:center;justify-content:center"><svg width="164" height="40" viewBox="0 0 164 40" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none"><rect x="0" y="0" width="3" height="40" fill="#111"/><rect x="6" y="0" width="3" height="40" fill="#111"/><rect x="10" y="0" width="2" height="40" fill="#111"/><rect x="13" y="0" width="2" height="40" fill="#111"/><rect x="18" y="0" width="3" height="40" fill="#111"/><rect x="24" y="0" width="1" height="40" fill="#111"/><rect x="27" y="0" width="1" height="40" fill="#111"/><rect x="30" y="0" width="3" height="40" fill="#111"/><rect x="36" y="0" width="3" height="40" fill="#111"/><rect x="40" y="0" width="2" height="40" fill="#111"/><rect x="43" y="0" width="2" height="40" fill="#111"/><rect x="48" y="0" width="3" height="40" fill="#111"/><rect x="54" y="0" width="1" height="40" fill="#111"/><rect x="57" y="0" width="1" height="40" fill="#111"/><rect x="60" y="0" width="3" height="40" fill="#111"/><rect x="66" y="0" width="3" height="40" fill="#111"/><rect x="70" y="0" width="2" height="40" fill="#111"/><rect x="73" y="0" width="2" height="40" fill="#111"/><rect x="78" y="0" width="3" height="40" fill="#111"/><rect x="84" y="0" width="1" height="40" fill="#111"/><rect x="87" y="0" width="1" height="40" fill="#111"/><rect x="90" y="0" width="3" height="40" fill="#111"/><rect x="96" y="0" width="3" height="40" fill="#111"/><rect x="100" y="0" width="2" height="40" fill="#111"/><rect x="103" y="0" width="2" height="40" fill="#111"/><rect x="108" y="0" width="3" height="40" fill="#111"/><rect x="114" y="0" width="1" height="40" fill="#111"/><rect x="117" y="0" width="1" height="40" fill="#111"/><rect x="120" y="0" width="3" height="40" fill="#111"/><rect x="126" y="0" width="3" height="40" fill="#111"/><rect x="130" y="0" width="2" height="40" fill="#111"/><rect x="133" y="0" width="2" height="40" fill="#
// …
运行结果
- 若无法打印或连接客户端失败,请参阅 本地Print succeeded,上线后无法打印?(HTTP 业务系统上线后常见)。
- 客户端内置「运行示例」页(
vueApp/.../examples/index.vue)提供更多可编辑 demo,与本页样例互补。 - 工具类样例(连接检测、打印机列表等)仅返回 JSON,不触发打印。