在线样例

请启用 JavaScript 后使用在线样例。

您的浏览器版本过旧,请升级至 Chrome、Edge、Firefox 或 Safari 最新版后再访问在线样例。

左侧浏览样例目录,右侧查看版式预览与示例代码;点击运行即可通过 web-print-pdf 驱动本地客户端完成静默打印或 PDF 预览。使用前请先 安装并启动客户端。

客户端

若打印或预览效果与预期不符,请务必先从官网下载并安装最新版 Web打印专家客户端后再试(旧版本可能导致版式偏差)。

版式说明

版式预览与打印输出完全遵循 HTML/CSS 标准样式,没有隐藏的渲染技巧:样式写成什么样,页面就长成什么样。

56 - 仓库货位卡

仓库货位卡打印样例。

示例代码

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: 227px;
      height: 151px;
      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:3px;top:3px;width:221px;height:145px;box-sizing:border-box;overflow:hidden;border:1px solid #065F46;box-sizing:border-box"></div>
<div style="position:absolute;left:8px;top:8px;width:211px;height:18px;box-sizing:border-box;overflow:hidden;font-size:12px;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:3px;top:30px;width:221px;height:1px;box-sizing:border-box;overflow:hidden;background:#065F46"></div>
<div style="position:absolute;left:52px;top:33px;width:111px;height:16px;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:8px;top:34px;width:42px;height:14px;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:52px;top:55px;width:111px;height:16px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">A-03-02-01</div>
<div style="position:absolute;left:8px;top:56px;width:42px;height:14px;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:52px;top:77px;width:111px;height:16px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">796 个</div>
<div style="position:absolute;left:8px;top:78px;width:42px;height:14px;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:8px;top:107px;width:211px;height:34px;box-sizing:border-box;overflow:hidden;display:flex;flex-direction:column;align-items:center;justify-content:center"><svg width="211" height="24" viewBox="0 0 211 24" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none"><rect x="0" y="0" width="3" height="24" fill="#111"/><rect x="4" y="0" width="1" height="24" fill="#111"/><rect x="6" y="0" width="1" height="24" fill="#111"/><rect x="8" y="0" width="2" height="24" fill="#111"/><rect x="13" y="0" width="1" height="24" fill="#111"/><rect x="15" y="0" width="1" height="24" fill="#111"/><rect x="17" y="0" width="1" height="24" fill="#111"/><rect x="20" y="0" width="3" height="24" fill="#111"/><rect x="24" y="0" width="1" height="24" fill="#111"/><rect x="26" y="0" width="1" height="24" fill="#111"/><rect x="28" y="0" width="2" height="24" fill="#111"/><rect x="33" y="0" width="1" height="24" fill="#111"/><rect x="35" y="0" width="1" height="24" fill="#111"/><rect x="37" y="0" width="1" height="24" fill="#111"/><rect x="40" y="0" width="3" height="24" fill="#111"/><rect x="44" y="0" width="1" height="24" fill="#111"/><rect x="46" y="0" width="1" height="24" fill="#111"/><rect x="48" y="0" width="2" height="24" fill="#111"/><rect x="53" y="0" width="1" height="24" fill="#111"/><rect x="55" y="0" width="1" height="24" fill="#111"/><rect x="57" y="0" width="1" height="24" fill="#111"/><rect x="60" y="0" width="3" height="24" fill="#111"/><rect x="64" y="0" width="1" height="24" fill="#111"/><rect x="66" y="0" width="1" height="24" fill="#111"/><rect x="68" y="0" width="2" height="24" fill="#111"/><rect x="73" y="0" width="1" height="24" fill="#111"/><rect x="75" y="0" width="1" height="24" fill="#111"/><rect x="77" y="0" width="1" height="24" fill="#111"/><rect x="80" y="0" width="3" height="24" fill="#111"/><rect x="84" y="0" width="1" height="24" fill="#111"/><rect x="86" y="0" width="1" height="24" fill="#111"/><rect x="88" y="0" width="2" height="24" fill="#111"/><rect x="93" y="0" width="1" height="24" fill="#111"/><rect x="95" y="0" width="1" height="24" fill="#111"/><rect x="97" y="0" width="1" height="24" fill="#111"/><rect x="100" y="0" width="3" height="24" fill="#111"/><rect x="104" y="0" width="1" height="24" fill="#111"/><rect x="106" y="0" width="1" height="24" fill="#111"/><rect x="108" y="0" width="2" height="24" fill="#111"/><rect x="113" y="0" width="1" height="24" fill="#111"/><rect x="115" y="0" width="1" height="24" fill="#111"/><rect x="117" y="0" width="1" height="24" fill="#111"/><rect x="120" y="0" width="3" height="24" fill="#111"/><rect x="124" y="0" width="1" height="24" fill="#111"/><rect x="126" y="0" width="1" height="24" fill="#111"/><rect x="128" y="0" width="2" height="24" fill="#111"/><rect x="133" y="0" width="1" height="24" fill="#111"/><rect x="135" y="0" width="1" height="24" fill="#111"/><rect x="137" y="0" width="1" height="24" fill="#111"/><rect x="140" y="0" width="3" height="24" fill="#111"/><rect x="144" y="0" width="1" height="24" fill="#111"/><rect x="146" y="0" width="1" height="24" fill="#111"/><rect x="148" y="0" width="2" height="24" fill="#111"/><rect x="153" y="0" width="1" height="24" fill="#111"/><rect x="155" y="0" width="1" height="24" fill="#111"/><rect x="157" y="0" width="1" height="24" fill="#111"/><rect x="160" y="0" width="3" height="24" fill="#111"/><rect x="164" y="0" width="1" height="24" fill="#111"/><rect x="166" y="0" width="1" height="24" fill="#111"/><rect x="168" y="0" width="2" height="24" fill="#111"/><rect x="173" y="0" width="1" h
// …

运行结果

  • 若无法打印或连接客户端失败,请参阅 本地Print succeeded,上线后无法打印?(HTTP 业务系统上线后常见)。
  • 客户端内置「运行示例」页(vueApp/.../examples/index.vue)提供更多可编辑 demo,与本页样例互补。
  • 工具类样例(连接检测、打印机列表等)仅返回 JSON,不触发打印。
免费下载客户端 查看 npm 包