返回顶部
i

invoice-generator发票生成器

Generate professional PDF invoices from JSON data. Use when the user needs to create an invoice, billing document, or payment request with company/client details and line items.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
4,103
下载量
免费
免费
2
收藏
概述
安装方式
版本历史

invoice-generator

发票生成器

从结构化JSON数据生成PDF发票。

设置

  1. 1. 安装Node.js依赖:

bash
cd invoice-generator && npm install

  1. 2. 设置INVOICE_DIR环境变量(或在skills.entries.invoice-generator.env中设置):

bash
export INVOICE_DIR=/path/to/your/invoices

这将创建目录结构:

$INVOICE_DIR/
├── configs/ # 可选:已保存的发票配置
└── invoices/ # 生成的PDF输出

使用方法

bash

从标准输入(即时处理)


cat invoice-data.json | {baseDir}/scripts/generate.sh

从完整文件路径

{baseDir}/scripts/generate.sh /path/to/invoice-data.json

从已保存的配置(在$INVOICE_DIR/configs/中查找)

{baseDir}/scripts/generate.sh client-template

加载:$INVOICE_DIR/configs/client-template.json

输出到:$INVOICE_DIR/invoices/invoice-{number}.pdf(如果存在则自动版本化)

输入数据格式

JSON输入必须包含以下字段:

json
{
company: {
name: 您的公司,
address: 123 Main St,
cityStateZip: 城市, 州, 12345,
country: 国家
},
client: {
name: 客户名称,
address: 456 Client Ave,
cityStateZip: 城市, 州, 67890,
country: 国家,
taxId: TAX123
},
invoice: {
number: INV-2025.01,
date: 2025年1月15日,
dueDate: 2025年1月30日
},
items: [
{
description: 服务描述,
rate: 1000.00,
currency: USD
}
],
totals: {
currency: USD,
total: 1,000.00
}
}

查看references/data-schema.md获取完整的字段文档。

输出

脚本在成功时输出生成的PDF文件路径:

$INVOICE_DIR/invoices/invoice-INV-2025.01.pdf

如果该文件名已存在,脚本将写入:


$INVOICE_DIR/invoices/invoice-INV-2025.01-2.pdf(然后-3,以此类推)

错误处理

  • - 如果JSON无效或缺少必填字段,退出代码为1
  • 如果weasyprint生成PDF失败,退出代码为2
  • 错误消息写入stderr

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 invoice-generator-1776420060 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 invoice-generator-1776420060 技能

通过命令行安装

skillhub install invoice-generator-1776420060

下载

⬇ 下载 invoice-generator v1.0.0(免费)

文件大小: 5.68 KB | 发布时间: 2026-4-17 19:10

v1.0.0 最新 2026-4-17 19:10
Initial release: Generate PDF invoices from structured JSON.

- Converts invoice data in JSON format to professional PDF files.
- Supports multiple input methods: stdin, file path, or saved config.
- Stores generated invoices in a user-specified directory.
- Handles auto-versioning for duplicate filenames.
- Provides clear error handling for invalid input or PDF generation issues.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部