在线样例

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

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

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

客户端

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

版式说明

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

32 - 增值税专用发票

增值税专用发票打印样例。

示例代码

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: 794px;
      height: 529px;
      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:16px;top:16px;width:762px;height:500px;box-sizing:border-box;overflow:hidden;background:#FFFFFF;border:1px solid #8B4A3B;box-sizing:border-box"></div>
<div style="position:absolute;left:247px;top:26px;width:300px;height:34px;box-sizing:border-box;overflow:hidden;font-size:22px;font-weight:700;color:#8B4A3B;text-align:center;display:flex;align-items:center;justify-content:center;white-space:pre-wrap">增值税专用发票</div>
<div style="position:absolute;left:596px;top:28px;width:60px;height:16px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#8B4A3B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">发票代码</div>
<div style="position:absolute;left:656px;top:28px;width:108px;height:16px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#8B4A3B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">033002100311</div>
<div style="position:absolute;left:32px;top:32px;width:140px;height:18px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#8B4A3B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">第三联:记账联</div>
<div style="position:absolute;left:596px;top:46px;width:60px;height:16px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#8B4A3B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">发票号码</div>
<div style="position:absolute;left:656px;top:46px;width:108px;height:16px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#8B4A3B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">18863025</div>
<div style="position:absolute;left:32px;top:50px;width:190px;height:16px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#8B4A3B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">机器编号:661234567890</div>
<div style="position:absolute;left:596px;top:64px;width:60px;height:16px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#8B4A3B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">开票日期</div>
<div style="position:absolute;left:656px;top:64px;width:108px;height:16px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#8B4A3B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">2026-10-26</div>
<div style="position:absolute;left:596px;top:82px;width:60px;height:16px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#8B4A3B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">校验码</div>
<div style="position:absolute;left:656px;top:82px;width:108px;height:16px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#8B4A3B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">0123 4567 8901</div>
<div style="position:absolute;left:30px;top:100px;width:18px;height:92px;box-sizing:border-box;overflow:hidden;font-size:10px;color:#8B4A3B;text-align:center;display:flex;align-items:center;justify-content:center;white-space:pre-wrap">购
买
方</div>
<div style="position:absolute;left:540px;top:100px;width:222px;height:96px;box-sizing:border-box;overflow:hidden;border:1px solid #8B4A3B;box-sizing:border-box"></div>
<div style="position:absolute;left:52px;top:104px;width:44px;height:18px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#8B4A3B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">名称</div>
<div style="position:absolute;left:100px;top:104px;width:424px;height:18px;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:548px;top:110px;width:206px;height:76px;box-sizing:border-box;overflow:hidden;font-size:8px;color:#8B4A3B;white-space:pre-wrap">0389 1244 7188 3022 9188 4471 8830 2291 0556 3312</div>
<div style="position:absolute;left:52px;top:126px;width:74px;height:18px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#8B4A3B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">纳税人识别号</div>
<div style="position:absolute;left:130px;top:126px;width:394px;height:18px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">91330100MA2K8X8X0A</div>
<div style="position:absolute;left:52px;top:148px;width:74px;height:18px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#8B4A3B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">地址、电话</div>
<div style="position:absolute;left:130px;top:148px;width:394px;height:18px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">杭州市余杭区文一西路 969 号 0571-88886666</div>
<div style="position:absolute;left:52px;top:170px;width:74px;height:18px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#8B4A3B;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">开户行及账号</div>
<div style="position:absolute;left:130px;top:170px;width:394px;height:18px;box-sizing:border-box;overflow:hidden;font-size:9px;color:#0F172A;display:flex;align-items:center;justify-content:flex-start;white-space:pre-wrap">招商银行杭州分行 5719 0288 6611 001</div>
<div style="position:absolute;left:32px;top:204px;width:730px;height:190px;box-sizing:border-box;overflow:hidden;overflow:hidden"><table style="width:100%;max-widt
// …

运行结果

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