npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

invoicify

v1.0.0

Published

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

Downloads

6

Readme

Invoicify

Table of Contents

  1. Introduction
  2. Example
  3. Installation
  4. Usage
  5. API Reference
  6. Invoice Data Format
  7. 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:

  1. Import the necessary functions:

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

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

    const pdfBytes = await generateInvoice(basic, invoiceData);
  4. 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:

  1. Missing dependencies: Ensure all peer dependencies are installed (pdf-lib, qr-image)
  2. File not found: Check that the logoPath in your invoice data points to a valid image file
  3. 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.