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

visionvalt-receipt-generator

v1.1.7

Published

A package to generate receipt PDFs

Downloads

9

Readme

Receipt PDF Generator

Overview

The Receipt PDF Generator is a Node.js module that creates a professional PDF receipt based on provided receipt data. This module utilizes the pdfkit library to generate the receipt PDF file.

Usage

To use the Receipt PDF Generator, follow these steps:

  1. Import the Module: Import the generatePDFFile function from the module into your script.

  2. Prepare Receipt Data: Define the receipt data object with all necessary fields.

  3. Call the Function: Call the generatePDFFile function with the receipt data and the desired output file path.

Function Details

generatePDFFile(receiptData, outputFilePath)

Parameters:

receiptData: An object containing all necessary receipt information. outputFilePath: The file path where the PDF will be saved. Returns: The file path where the PDF has been saved.

Receipt Data Object The receiptData object should include the following properties:

date: Date of the receipt (e.g., '2024-08-17'). planName: Name of the plan or service. originalPrice: The original price before GST. logoPath: Path to the logo image. contactEmail: Contact email for support. contactMobile: Contact mobile number for support. invoiceID: Unique invoice identifier. items: Array of items with descriptions and amounts. billingPerson: Object with billing person's details (name, address, city, state, zip, country). paymentMethod: Method used for payment (e.g., 'Credit Card'). transactionID: Transaction identifier. additionalNotes: Additional notes about the transaction. gstRate: GST rate as a decimal (e.g., 0.18 for 18%).

Example Code

Here's a sample usage of the Receipt PDF Generator:

const { generatePDFFile } = require('./path/to/your/module');
const path = require('path');

// Define the receipt data
const receiptData = {
  date: '2024-08-17',
  planName: 'Premium Plan',
  originalPrice: 100.00,
  logoPath: 'assets/logo.png',
  contactEmail: '[email protected]',
  contactMobile: '+1234567890',
  invoiceID: 'INV-2024-0001',
  items: [
    { description: 'Service Fee', amount: 50.00 },
    { description: 'Additional Charges', amount: 10.00 }
  ],
  billingPerson: {
    name: 'John Doe',
    address: '123 Elm Street',
    city: 'Springfield',
    state: 'IL',
    zip: '62701',
    country: 'USA'
  },
  paymentMethod: 'Credit Card',
  transactionID: 'TRX-2024-123456',
  additionalNotes: 'Payment was processed successfully.',
  gstRate: 0.18 // GST rate as a decimal (18% GST)
};

// Define the path where the PDF will be saved
const outputFilePath = path.join(__dirname, 'custom_receipt_path.pdf');

// Generate the PDF file
generatePDFFile(receiptData, outputFilePath);






License
This project is licensed under the MIT License. See the LICENSE file for details.