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

pdfnoodle

v1.0.0

Published

Node.js SDK for the pdf noodle API

Readme

pdfnoodle

Node.js SDK for the PDFNoodle API.

Features

  • TypeScript-first with full type definitions
  • Dual ESM/CJS support
  • Zero runtime dependencies (uses native fetch)
  • Automatic polling with exponential backoff for long-running PDF generations
  • Consistent { data, error } response pattern

Installation

npm install pdfnoodle

Requires Node.js 20+.

Quick Start

import { PdfNoodle } from 'pdfnoodle';

const pdfnoodle = new PdfNoodle('pdfnoodle_api_...');
// or set PDFNOODLE_API_KEY environment variable

// Generate PDF from HTML
const { data, error } = await pdfnoodle.pdf.fromHTML({
  html: '<h1>Invoice #001</h1><p>Total: $100</p>',
  pdfParams: { format: 'A4', printBackground: true },
});

if (data) {
  console.log(data.signedUrl); // temporary download URL
}

API

Constructor

const pdfnoodle = new PdfNoodle(apiKey?: string);

The API key can be passed directly or read from the PDFNOODLE_API_KEY environment variable. The base URL defaults to https://api.pdfnoodle.com and can be overridden with PDFNOODLE_BASE_URL.

PDF Generation

// Synchronous HTML to PDF (auto-polls if server returns 202)
const result = await pdfnoodle.pdf.fromHTML(payload, pollingOptions?);

// Asynchronous HTML to PDF (requires webhook)
const result = await pdfnoodle.pdf.fromHTMLAsync(payload);

// Synchronous template to PDF (auto-polls if server returns 202)
const result = await pdfnoodle.pdf.fromTemplate(payload, pollingOptions?);

// Asynchronous template to PDF (requires webhook)
const result = await pdfnoodle.pdf.fromTemplateAsync(payload);

// Check generation status
const result = await pdfnoodle.pdf.getStatus(requestId);

Automatic Polling

When sync endpoints take longer than 30 seconds, the API returns a 202 status. The SDK automatically polls the status endpoint until completion. Configure polling behavior:

const result = await pdfnoodle.pdf.fromHTML(payload, {
  pollInterval: 2000,       // initial delay between polls (ms)
  maxAttempts: 20,           // max polls before timeout
  backoffMultiplier: 1.5,    // exponential backoff factor
  maxPollInterval: 10000,    // max delay cap (ms)
  signal: abortController.signal, // cancel polling
});

Templates

// Create a template (AI-powered)
const result = await pdfnoodle.templates.create({
  prompt: 'Create an invoice template',
  displayName: 'Standard Invoice',
});

// Get a template
const result = await pdfnoodle.templates.get(templateId);

// List all templates
const result = await pdfnoodle.templates.list();

// Get template variables schema
const result = await pdfnoodle.templates.getVariables(templateId);

Tools

// Get a signed upload URL
const result = await pdfnoodle.tools.getSignedUploadUrl(fileName?);

// Merge PDFs
const result = await pdfnoodle.tools.mergePdfs({ urls: [...] });

// Split PDF
const result = await pdfnoodle.tools.splitPdf({ url, splitMode: 'ranges', ranges: '1-3,5' });

// Compress PDF
const result = await pdfnoodle.tools.compressPdf({ url, compressLevel: 'medium' });

// Convert Markdown to PDF
const result = await pdfnoodle.tools.markdownToPdf({ markdown: '# Hello' });

// Update PDF metadata
const result = await pdfnoodle.tools.updatePdfMetadata({
  url,
  metadata: { title: 'Report', author: 'Acme' },
});

Response Pattern

All methods return { data, error }:

const { data, error } = await pdfnoodle.pdf.fromHTML({ html: '...' });

if (error) {
  console.error(error.name, error.message);
  return;
}

console.log(data.signedUrl);

License

MIT