{"id":30176346,"url":"https://github.com/casoon/invoice-generator","last_synced_at":"2025-08-12T02:45:32.456Z","repository":{"id":307362886,"uuid":"1029316907","full_name":"casoon/invoice-generator","owner":"casoon","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-30T21:22:12.000Z","size":99,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-30T22:36:55.472Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/casoon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-30T21:21:13.000Z","updated_at":"2025-07-30T21:22:15.000Z","dependencies_parsed_at":"2025-07-30T22:36:57.841Z","dependency_job_id":"d9c89efd-3813-4810-a47f-aa880c92c363","html_url":"https://github.com/casoon/invoice-generator","commit_stats":null,"previous_names":["casoon/invoice-generator"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/casoon/invoice-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casoon%2Finvoice-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casoon%2Finvoice-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casoon%2Finvoice-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casoon%2Finvoice-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/casoon","download_url":"https://codeload.github.com/casoon/invoice-generator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casoon%2Finvoice-generator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269991518,"owners_count":24509009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-12T02:45:31.324Z","updated_at":"2025-08-12T02:45:32.419Z","avatar_url":"https://github.com/casoon.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @casoon/invoice-generator\n\nA TypeScript npm package for generating PDF invoices, XRechnung XML, and ZUGFeRD PDF/A-3 from JSON data.\n\n## 🚀 Features\n\n- ✅ Generate PDF invoices from JSON data\n- ✅ XRechnung XML generation\n- ✅ ZUGFeRD PDF/A-3 support\n- ✅ TypeScript with full type safety\n- ✅ DIN 5008 layout standard\n- ✅ German and English localization\n- ✅ Logo integration\n- ✅ Comprehensive tests\n- ✅ Simple API\n\n## 📦 Installation\n\n```bash\nnpm install @casoon/invoice-generator\n```\n\n## 🛠️ Usage\n\n### CLI Usage\n\n```bash\n# Install globally\nnpm install -g @casoon/invoice-generator\n\n# Generate PDF from JSON file\ninvoice-generator --input=data/test-invoice.json --output=invoice.pdf\n\n# Generate PDF and XRechnung XML\ninvoice-generator --input=data/test-invoice.json --output=invoice.pdf --xml=xrechnung.xml\n```\n\n### Simple Usage\n\n```typescript\nimport { generateFromJSON } from '@casoon/invoice-generator';\n\n// Generate PDF from JSON file\nawait generateFromJSON(\n  './data/test-invoice.json',\n  './output/invoice.pdf'\n);\n```\n\n### Advanced Usage\n\n```typescript\nimport { \n  generateInvoicePDF, \n  generateInvoicePDFToFile, \n  loadInvoiceData \n} from '@casoon/invoice-generator';\n\n// Load JSON data\nconst invoiceData = loadInvoiceData('./data/test-invoice.json');\n\n// Generate PDF with custom options\nawait generateInvoicePDFToFile(\n  invoiceData,\n  './output/invoice.pdf',\n  {\n    template: 'default',\n    language: 'de',\n    includeLogo: true,\n    logoPath: './logo.png'\n  }\n);\n\n// Generate PDF as buffer\nconst pdfBuffer = await generateInvoicePDF(invoiceData);\n```\n\n### Direct Usage with Invoice Data\n\n```typescript\nimport { generateInvoicePDFToFile } from '@casoon/invoice-generator';\n\nconst invoice = {\n  sender: {\n    name: \"Max Mustermann\",\n    company: \"Musterfirma GmbH\",\n    address: {\n      street: \"Musterstraße 123\",\n      postalCode: \"12345\",\n      city: \"Musterstadt\"\n    },\n    contactInfo: {\n      phone: \"+49 123 456789\",\n      mobile: \"+49 987 654321\",\n      email: \"max.mustermann@example.com\",\n      website: \"www.musterfirma.de\"\n    },\n    businessOwner: \"Max Mustermann\",\n    vatId: \"DE123456789\"\n  },\n  recipient: {\n    name: \"Testkunde AG\",\n    address: {\n      street: \"Teststraße 456\",\n      postalCode: \"54321\",\n      city: \"Teststadt\"\n    }\n  },\n  details: {\n    invoiceNumber: \"RE2025001\",\n    customerNumber: \"K001\",\n    invoiceDate: \"01.02.25\",\n    deliveryDate: \"01.02.25\",\n    servicePeriod: \"01-03/2025\",\n    dueDate: \"08.02.25\",\n    vatId: \"DE123456789\"\n  },\n  salutation: {\n    greeting: \"Sehr geehrte Damen und Herren,\",\n    introduction: \"wir bedanken uns für Ihren Auftrag und erlauben uns, wie folgt zu berechnen:\"\n  },\n  items: [\n    {\n      description: \"Webhosting Premium, Gebühr für example.com - Premium Hosting mit SSL-Zertifikat\",\n      quantity: 3,\n      unit: \"Stück\",\n      vatRate: 19,\n      unitPrice: 25.00,\n      total: 75.00,\n      currency: \"EUR\"\n    }\n  ],\n  totals: {\n    netAmount: 90.00,\n    vatRate: 19.00,\n    vatAmount: 17.10,\n    grossAmount: 107.10,\n    currency: \"EUR\"\n  },\n  paymentInfo: {\n    paymentTerms: \"Zahlbar ohne Abzug bis zum 08.02.25\",\n    dueDate: \"08.02.25\",\n    bank: \"Testbank AG\",\n    accountHolder: \"Max Mustermann\",\n    iban: \"DE12 3456 7890 1234 5678 90\",\n    bic: \"TESTDE12XXX\"\n  },\n  metadata: {\n    createdWith: \"Invoice Generator\",\n    creationDate: new Date().toISOString(),\n    filename: \"test-invoice.json\"\n  }\n};\n\nawait generateInvoicePDFToFile(invoice, './output/invoice.pdf');\n```\n\n## 📋 JSON Data Format\n\nThe package expects JSON data in the following format:\n\n```json\n{\n  \"sender\": {\n    \"name\": \"Max Mustermann\",\n    \"company\": \"Musterfirma GmbH\",\n    \"address\": {\n      \"street\": \"Musterstraße 123\",\n      \"postalCode\": \"12345\",\n      \"city\": \"Musterstadt\"\n    },\n    \"contactInfo\": {\n      \"phone\": \"+49 123 456789\",\n      \"mobile\": \"+49 987 654321\",\n      \"email\": \"max.mustermann@example.com\",\n      \"website\": \"www.musterfirma.de\"\n    },\n    \"businessOwner\": \"Max Mustermann\",\n    \"vatId\": \"DE123456789\"\n  },\n  \"recipient\": {\n    \"name\": \"Testkunde AG\",\n    \"address\": {\n      \"street\": \"Teststraße 456\",\n      \"postalCode\": \"54321\",\n      \"city\": \"Teststadt\"\n    }\n  },\n  \"details\": {\n    \"invoiceNumber\": \"RE2025001\",\n    \"customerNumber\": \"K001\",\n    \"invoiceDate\": \"01.02.25\",\n    \"deliveryDate\": \"01.02.25\",\n    \"servicePeriod\": \"01-03/2025\",\n    \"dueDate\": \"08.02.25\",\n    \"vatId\": \"DE123456789\"\n  },\n  \"salutation\": {\n    \"greeting\": \"Sehr geehrte Damen und Herren,\",\n    \"introduction\": \"wir bedanken uns für Ihren Auftrag und erlauben uns, wie folgt zu berechnen:\"\n  },\n  \"items\": [\n    {\n      \"description\": \"Webhosting Premium, Gebühr für example.com - Premium Hosting mit SSL-Zertifikat\",\n      \"quantity\": 3,\n      \"unit\": \"Stück\",\n      \"vatRate\": 19,\n      \"unitPrice\": 25.00,\n      \"total\": 75.00,\n      \"currency\": \"EUR\"\n    }\n  ],\n  \"totals\": {\n    \"netAmount\": 90.00,\n    \"vatRate\": 19.00,\n    \"vatAmount\": 17.10,\n    \"grossAmount\": 107.10,\n    \"currency\": \"EUR\"\n  },\n  \"paymentInfo\": {\n    \"paymentTerms\": \"Zahlbar ohne Abzug bis zum 08.02.25\",\n    \"dueDate\": \"08.02.25\",\n    \"bank\": \"Testbank AG\",\n    \"accountHolder\": \"Max Mustermann\",\n    \"iban\": \"DE12 3456 7890 1234 5678 90\",\n    \"bic\": \"TESTDE12XXX\"\n  },\n  \"metadata\": {\n    \"createdWith\": \"Invoice Generator\",\n    \"creationDate\": \"2025-02-01T07:30:37Z\",\n    \"filename\": \"test-invoice.json\"\n  }\n}\n```\n\n## ✅ Validation\n\nThe package includes comprehensive validation for invoice data:\n\n```typescript\nimport { validateInvoice, validateEmail, validateIBAN, validateBIC } from '@casoon/invoice-generator';\n\n// Validate complete invoice\nconst validation = validateInvoice(invoice);\nif (!validation.isValid) {\n  console.error('Validation errors:', validation.errors);\n}\n\n// Validate specific fields\nconst isValidEmail = validateEmail('test@example.com');\nconst isValidIBAN = validateIBAN('DE12 3456 7890 1234 5678 90');\nconst isValidBIC = validateBIC('TESTDE12XXX');\n```\n\n## ⚙️ Configuration\n\n### PDFOptions\n\n```typescript\ninterface PDFOptions {\n  outputPath?: string;        // Output path for PDF\n  template?: 'default' | 'modern' | 'minimal';  // Template variant\n  language?: 'de' | 'en';     // Language\n  includeLogo?: boolean;      // Include logo\n  logoPath?: string;          // Path to logo\n}\n```\n\n## 🔌 XRechnung Support\n\nGenerate XRechnung XML files for German electronic invoicing:\n\n```typescript\nimport { generateXRechnungXMLFile } from '@casoon/invoice-generator';\n\n// Generate XRechnung XML\nawait generateXRechnungXMLFile(invoice, './output/xrechnung.xml');\n```\n\n## 📄 ZUGFeRD Support\n\nGenerate ZUGFeRD PDF/A-3 files with embedded XML:\n\n```typescript\nimport { ZUGFeRDPDFA3Generator } from '@casoon/invoice-generator';\n\n// Create ZUGFeRD generator\nconst zugferdGenerator = new ZUGFeRDPDFA3Generator(invoice, {\n  profile: 'BASIC',\n  version: '2.1.1'\n});\n\n// Generate ZUGFeRD PDF/A-3\nawait zugferdGenerator.generateZUGFeRDPDFA3('./output/zugferd.pdf');\n```\n\n## 🧪 Testing\n\n```bash\n# Run tests\nnpm test\n\n# Run tests with coverage\nnpm run test:coverage\n```\n\n## 📁 Project Structure\n\n```\n@casoon/invoice-generator/\n├── src/\n│   ├── types/\n│   │   └── invoice.types.ts          # TypeScript types\n│   ├── generators/\n│   │   ├── pdf-generator.ts          # PDF generator\n│   │   ├── xml/\n│   │   │   └── xrechnung-generator.ts # XRechnung XML generator\n│   │   └── zugferd/\n│   │       ├── zugferd-generator.ts   # ZUGFeRD generator\n│   │       └── zugferd-pdfa3-generator.ts # ZUGFeRD PDF/A-3\n│   └── index.ts                      # Main export\n├── tests/\n│   ├── invoice-generator.test.ts     # Tests\n│   └── zugferd-generator.test.ts     # ZUGFeRD tests\n├── examples/\n│   └── usage-example.ts              # Usage examples\n├── data/\n│   └── test-invoice.json             # Test data\n├── docs/\n│   ├── ZUGFeRD-pdf-lib.md           # ZUGFeRD documentation\n│   └── npm-publishing.md            # npm publishing guide\n├── package.json\n├── tsconfig.json\n└── README.md\n```\n\n## 🔧 Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Build project\nnpm run build\n\n# Start development server\nnpm run dev\n\n# Run tests\nnpm test\n```\n\n## 📄 License\n\nMIT\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📞 Support\n\nFor questions or issues, please create an issue on GitHub.\n\n## 🗺️ Roadmap\n\nFor planned development and features, see [ROADMAP.md](./ROADMAP.md).\n\n## 📋 Changelog\n\nFor changes and version history, see [CHANGELOG.md](./CHANGELOG.md).\n\n## 🔗 Related\n\n- [XRechnung Standard](https://www.xoev.de/xrechnung)\n- [ZUGFeRD Standard](https://www.ferd-net.de/standards/zugferd/index.html)\n- [DIN 5008](https://www.din.de/de/mitwirken/normenausschuesse/naerg/ueber-uns/din-5008) ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasoon%2Finvoice-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcasoon%2Finvoice-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasoon%2Finvoice-generator/lists"}