New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

invoicify

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

invoicify

An invoice generator tool to help you generate minimal and clean pdf invoices/reciepts.

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
4
100%
Maintainers
0
Weekly downloads
 
Created
Source

Invoicify

Table of Contents

  • Introduction
  • Example
  • Installation
  • Usage
  • API Reference
  • Invoice Data Format
  • Troubleshooting

Introduction

Invoicify is a Node.js package that creates professional PDF invoices. It uses the pdf-lib library for PDF generation and includes a basic invoice template.

Example

Template 1: Basic

Installation

To install the invoicify package, run the following command in your project directory:

npm install invoicify

Usage

To generate an invoice using this package:

  • Import the necessary functions:

    import { generateInvoice, basic } from 'invoicify';
    
  • Prepare your invoice data:

    const invoiceData = {
      companyName: 'Your Company',
      companyUrl: 'www.yourcompany.com',
      logoPath: './path/to/your/logo.png',
      // ... (other invoice details)
    };
    
  • Generate the PDF:

    const pdfBytes = await generateInvoice(basic, invoiceData);
    
  • Save the PDF:

    import fs from 'fs/promises';
    await fs.writeFile('invoice.pdf', pdfBytes);
    

API Reference

generateInvoice(template, data)

Generates a PDF invoice based on the provided template and data.

Parameters:

  • template: The invoice template function (use basic for the default template)
  • data: An object containing invoice information (see Invoice Data Format)

Returns: A Promise that resolves to PDF bytes

basic

The default invoice template function. Pass this to generateInvoice to use the basic template.

Invoice Data Format

The data object passed to generateInvoice should have the following format:

{
  companyName: String,
  companyUrl: String,
  logoPath: String,
  companyPhone: String,
  companyEmail: String,
  companyAddress: String,
  invoiceNumber: String,
  invoiceDate: String,
  customerName: String,
  customerAddress: String,
  customerEmail: String,
  customerPhone: String,
  items: [
    { name: String, qty: String, price: String, total: String },
    // ... more items
  ],
  subtotal: String,
  shipping: String,
  tax: String,
  total: String,
  supportEmail: String,
  notes: [String] 
}

Troubleshooting

Common issues and solutions:

  • Missing dependencies: Ensure all peer dependencies are installed (pdf-lib, qr-image)
  • File not found: Check that the logoPath in your invoice data points to a valid image file
  • Incorrect data format: Verify that your invoice data object matches the expected structure

For further assistance, please open an issue on the package's GitHub repository.

Keywords

invoicify

FAQs

Package last updated on 25 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts