JSPM

js-certificate-maker

0.0.6
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 15
  • Score
    100M100P100Q50479F
  • License ISC

A package to generate PDF certificates with custom names and styling

Package Exports

  • js-certificate-maker
  • js-certificate-maker/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (js-certificate-maker) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Certificate Generator NPM JavaScript GitHub Git

A Node.js package to generate personalized certificates in PDF format.

Installation

npm i js-certificate-maker

Features

  • Dynamically generates personalized certificates for events, workshops, or courses
  • Supports batch processing for multiple recipients
  • Allows customization of font color and positioning
  • Uses PDF-Lib library for robust PDF generation capabilities

Usage

To generate certificates, use the following command:

// Example usage:

const fontUrl = path.resolve(__dirname, "./assets/DancingScript-Variable.ttf");
const pdfTemplateUrl = path.resolve(__dirname, "./assets/certificate1.pdf");
const outputDir = path.resolve(__dirname, "output");

const names = ["John Doe", "Jane Smith", "Max Mustermann"];
const customColor = rgb(0.5, 0, 0.5);

generateCertificates(
  fontUrl,
  pdfTemplateUrl,
  names,
  outputDir,
  customColor,
  100,
  -50
)
  .then(() => console.log("All PDFs generated successfully"))
  .catch((error) => console.error("Error generating PDFs:", error));

Configuration

generateCertificates(fontUrl, pdfTemplateUrl, names, outputDir, fontColor, xm, ym)

  • fontUrl (string): Path to the font file (.ttf)
  • pdfTemplateUrl (string): Path to the PDF template (.pdf)
  • names (array of string): Array of names to generate certificates for
  • outputDir (string): Directory to save generated PDFs
  • fontColor (rgb): Color of the text (default: black)
  • xm (number): X-axis offset (default: 0)
  • ym (number): Y-axis offset (default: 0)

Contributing

Contributions are welcome! Please feel free to submit pull requests or issues.

  1. Fork and Clone the repository:

    git clone https://github.com/yourusername/js-certificate-maker.git
  2. Navigate to the project directory:

    cd js-certificate-maker
  3. Install dependencies:

    npm install