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 🙏

© 2026 – Pkg Stats / Ryan Hefner

siteforge-pdf

v1.0.0

Published

Official Node.js SDK for SiteForge PDF - HTML to PDF conversion API

Readme

SiteForge PDF

Official Node.js SDK for SiteForge PDF — simple HTML to PDF conversion API.

  • 100 free conversions/month
  • 💳 Pay-as-you-go: $0.02 per conversion after free tier
  • 🚀 Fast: Sub-second conversion times
  • 📄 Simple: Just send HTML, get PDF

Installation

npm install siteforge-pdf

Quick Start

const pdf = require('siteforge-pdf');
const fs = require('fs');

// Initialize with your API key
const client = pdf('sf_pdf_your_api_key');

// Convert HTML to PDF
const buffer = await client.convert('<h1>Hello World</h1>');
fs.writeFileSync('hello.pdf', buffer);

Get Your API Key

  1. Sign up at pdf.siteforge.build
  2. Get your API key from the dashboard
  3. Start converting!

Usage

Convert HTML

const pdf = require('siteforge-pdf');
const client = pdf('sf_pdf_your_key');

// Simple HTML
const buffer = await client.convert('<h1>Invoice #123</h1><p>Amount: $100</p>');

// With options
const buffer = await client.convert(html, {
    format: 'Letter',      // A4, Letter, Legal
    landscape: true,       // Landscape orientation
    margin: 'small',       // none, small, default, large
    printBackground: true  // Include background colors/images
});

fs.writeFileSync('invoice.pdf', buffer);

Convert URL

// Convert any public URL to PDF
const buffer = await client.convertUrl('https://example.com');

// With options
const buffer = await client.convertUrl('https://example.com', {
    format: 'A4',
    waitMs: 1000  // Wait for JS to render
});

fs.writeFileSync('example.pdf', buffer);

Check Usage

const usage = await client.usage();
console.log(usage);
// {
//   plan: 'free',
//   period: '2024-01',
//   currentMonth: { conversions: 42, ... },
//   limits: { monthly: 100, remaining: 58 }
// }

CLI

The package includes a command-line tool:

# Set your API key
export SITEFORGE_PDF_KEY=sf_pdf_your_key

# Convert HTML
siteforge-pdf --html "<h1>Hello</h1>" -o hello.pdf

# Convert a file
siteforge-pdf --file invoice.html -o invoice.pdf

# Convert a URL
siteforge-pdf --url https://example.com -o example.pdf

# With options
siteforge-pdf --html "<h1>Report</h1>" -o report.pdf --landscape --format Letter

# Check usage
siteforge-pdf --usage

TypeScript

Full TypeScript support included:

import pdf, { SiteForgePDF, ConvertOptions } from 'siteforge-pdf';

const client: SiteForgePDF = pdf('sf_pdf_your_key');

const options: ConvertOptions = {
    format: 'A4',
    landscape: false
};

const buffer: Buffer = await client.convert('<h1>Hello</h1>', options);

Options

Client Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | baseUrl | string | https://pdf.siteforge.build | API base URL | | timeout | number | 60000 | Request timeout in ms |

Convert Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | format | string | 'A4' | Page format: A4, Letter, Legal | | landscape | boolean | false | Landscape orientation | | margin | string | 'default' | Margin: none, small, default, large | | printBackground | boolean | true | Include background graphics | | waitMs | number | 0 | Wait before capture (for JS rendering) |

Error Handling

const pdf = require('siteforge-pdf');
const client = pdf('sf_pdf_your_key');

try {
    const buffer = await client.convert('<h1>Hello</h1>');
    fs.writeFileSync('output.pdf', buffer);
} catch (err) {
    if (err.statusCode === 401) {
        console.error('Invalid API key');
    } else if (err.statusCode === 429) {
        console.error('Rate limit exceeded');
    } else {
        console.error('Conversion failed:', err.message);
    }
}

Pricing

| Plan | Monthly Conversions | Price | |------|---------------------|-------| | Free | 100 | $0 | | Pay-as-you-go | Unlimited | $0.02 each |

Free tier includes a small watermark. Upgrade to PAYG for watermark-free PDFs.

Links

License

MIT © SiteForge