PrintBase
  • Product
  • Pricing
  • Docs
  • Resources
PrintBase/专题/平台打印接入

金蝶云星空如何自动打印出库单

出库单 PDF 由你的星空侧服务或中间程序提交给打印接口。没有金蝶认证插件,也不把打印机暴露到公网。调用 POST /v1/print-jobs,API Key 只放在服务端。

面向 需要把星空出库单打到仓库打印机的实施团队

说明

金蝶云星空里审核出库单之后,纸要出现在仓库。星空云端看不到你仓库的 USB 口。本产品没有金蝶认证插件,也不替代星空的套打设计器。你在已经能导出 PDF 的插件、服务端脚本或中间程序里调用打印接口。打印机由门店电脑上的 Agent 主动连出,不需要公网 IP,也不需要把 9100 端口映射到互联网。

把套打结果导出为 PDF,content_type 设为 pdf,printer_code 指向该仓库电脑上的打印机。API Key 放在服务端配置。不要把星空网页上需要登录的附件地址直接给 Agent。

Idempotency-Key 用出库单编号。重复审核或消息重放不会打出第二张,除非你换 key。

创建任务使用 POST /v1/print-jobs,请求头 Authorization: Bearer,正文包含 printer_code、content_type(pdf 或 raw)以及 content 或 content_url 二者之一。免费套餐是一台电脑每月 100 个任务。

创建任务使用 POST /v1/print-jobs,请求头 Authorization: Bearer,正文包含 printer_code、content_type(pdf 或 raw)以及 content 或 content_url 二者之一。免费套餐是一台电脑每月 100 个任务。

接入步骤

  1. 01

    先得到 PDF

    沿用你现在的套打模板,导出 PDF 字节。接口不读取金蝶表单。请求使用 POST /v1/print-jobs,请求头为 Authorization: Bearer,printer_code 来自 GET /v1/printers。

  2. 02

    中间程序持有密钥

    星空客户端界面不要看到 Bearer token。请求使用 POST /v1/print-jobs,请求头为 Authorization: Bearer,printer_code 来自 GET /v1/printers。

  3. 03

    按仓库选择打印机

    printer_code 存在你的仓库对照表。请求使用 POST /v1/print-jobs,请求头为 Authorization: Bearer,printer_code 来自 GET /v1/printers。

  4. 04

    POST /v1/print-jobs

    content 为 base64,copies 按联数。请求使用 POST /v1/print-jobs,请求头为 Authorization: Bearer,printer_code 来自 GET /v1/printers。

  5. 05

    把 job id 写回日志

    现场说没出纸时,先看 reason code。请求使用 POST /v1/print-jobs,请求头为 Authorization: Bearer,printer_code 来自 GET /v1/printers。

Java

// 星空侧中间程序:出库单 PDF
var json = """
{"printer_code":%d,"content_type":"pdf",\"content\":\"" + pdfBase64 + "\","copies":1}
""".formatted(printerCode);
var req = HttpRequest.newBuilder(URI.create("https://api.printbase.cloud/v1/print-jobs"))
    .header("Authorization", "Bearer " + apiKey)
    .header("Content-Type", "application/json")
    .header("Idempotency-Key", idempotencyKey)
    .POST(HttpRequest.BodyPublishers.ofString(json))
    .build();
var res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
if (res.statusCode() >= 300) throw new IllegalStateException(res.body());
// {"id":"job_abc","status":"queued"}

这一套的细节

不是套打控件的说明书

金蝶自己的套打仍然设计版式。这里只负责把已经生成的 PDF 送到一台系统可见的打印机。Agent 只打印你提交的内容,不会替你向平台拉取单据。Agent 只打印你提交的内容,不会替你向平台拉取单据。

怎样确认已经打出来

创建接口返回 id 和 status queued。之后是 queued、dispatched、printing、completed。失败原因包括 AGENT_OFFLINE、PRINTER_OFFLINE、DOWNLOAD_FAILED、PRINT_ERROR、INVALID_CONTENT。用 GET /v1/print-jobs/{id} 查询。Webhook 只在付费套餐提供,且只有 print_job.completed 和 print_job.failed。

常见问题

有金蝶云星空官方适配吗?

没有认证插件。由你的服务端调用 API。调用的仍是 POST /v1/print-jobs,请求头为 Bearer API Key。HTTP 201 只表示已排队,不表示已经出纸。

针式多联纸怎么办?(详见本页)

PDF 联数和纸盒由打印机驱动决定。可以传 copies。接口不能保证某一抽屉出纸。调用的仍是 POST /v1/print-jobs,请求头为 Bearer API Key。HTTP 201 只表示已排队,不表示已经出纸。

要 VPN 吗?(详见本页)

打印这条链路不需要把仓库网暴露出来。Agent 向外连接。调用的仍是 POST /v1/print-jobs,请求头为 Bearer API Key。HTTP 201 只表示已排队,不表示已经出纸。

PDF 很大?(详见本页)

可以用 Agent 能下载的 https content_url,避免巨大的 base64。链接必须无需登录。调用的仍是 POST /v1/print-jobs,请求头为 Bearer API Key。HTTP 201 只表示已排队,不表示已经出纸。

相关页面

  • 用友如何自动打印出库单

    用友出库单导出 PDF 后,由你的服务调用打印接口打到仓库。没有用友插件,打印机也不需要公网 IP。调用 POST /v1/print-jobs,API Key 只放在服务端。

  • 连锁门店由总部下发单据

    总部审核单据后,按门店的 printer_code 打到该门店。不要在门店离线时改打到总部打印机。调用 POST /v1/print-jobs,API Key 只放在服务端。

  • Odoo 如何打印斑马标签而不用 IoT Box

    在 Odoo 服务端动作里把 ZPL 发给仓库电脑上的斑马打印机。不安装 IoT Box,也没有官方 Odoo 模块。调用 POST /v1/print-jobs,API Key 只放在服务端。

免费套餐:一台电脑每月 100 个任务,不需要信用卡。

免费注册查看 API 文档
PrintBase

PrintBase connects your applications to physical printers anywhere - securely, reliably, and in real time.

Product
Receipt PrintingLabel PrintingDashboardDevicesWebhooks
Resources
DocsBlogStatusAPI ReferenceDownloadPrintBase vs PrintNodePrintNode PricingFAQ
Guides
All guidesIntegrationsPrintersCode samplesComparisonsUse casesTroubleshooting
Company
ContactSecurityPrivacy

© 2026 Aveniq Technologies OÜ. All rights reserved. PrintBase is a service of Aveniq Technologies OÜ.

PrivacyTermsRefunds