whatisgithub

What is clawpdf?

openclaw/clawpdf — explained in plain English

Analysis updated 2026-05-18

52TypeScriptAudience · developerComplexity · 2/5LicenseSetup · easy

In one sentence

A JavaScript library for extracting text and rendering pages from PDF files, built for feeding PDFs into AI models.

Mindmap

mindmap
  root((clawpdf))
    What it does
      Extracts PDF text
      Renders pages as PNG
      Handles password protected PDFs
    Tech stack
      TypeScript
      WebAssembly
      PDFium
    Use cases
      Feed PDFs into an AI model
      Extract text from documents
      Render PDF pages as images
    Audience
      JavaScript developers
      AI app builders

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Extract readable text from a PDF for an AI model to process

USE CASE 2

Render individual PDF pages as PNG images for scanned or image-heavy documents

USE CASE 3

Open and read password-protected PDF files in a Node.js server

USE CASE 4

Run a CLI command to pull text or images out of a PDF without writing code

What is it built with?

TypeScriptNode.jsWebAssemblyPDFium

How does it compare?

openclaw/clawpdfharborstremio/harbormodem-dev/sideshow
Stars525252
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasyeasyeasy
Complexity2/53/52/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Requires Node.js 20 or later.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

So what is it?

clawpdf is a TypeScript package that lets JavaScript code work with PDF files in Node.js or the browser, without installing any extra dependencies. It bundles Google's PDFium PDF engine compiled to WebAssembly, so there is no native addon to compile and no canvas library to install. The main things it can do are extract text from a PDF, render individual pages as PNG images, and handle password-protected files. There is an "auto" extraction mode that pulls text first and only falls back to rendering PNG images when the extracted text is too short to be useful. This is aimed at use cases where PDFs are being fed into an AI model: readable PDFs go in as text, scanned or image-heavy PDFs go in as images. An adapter function called toMessageContent can shape the output into blocks suitable for multimodal model input. The API centers on three main functions. openPdf opens a single document and gives you access to page count, text, and per-page PNG rendering. extractPdf is a one-shot function that applies the auto fallback logic. createEngine creates a reusable PDFium instance, which the README recommends for server code so you are not spinning up a new WASM engine for each request. A CLI is included so you can extract text or render pages directly from the terminal without writing any code. Both the Node.js and browser paths ship in the same package, the browser version pre-configures the WASM URL for bundlers, with an option to host the WASM file yourself. Benchmarks in the README show roughly half the processing time and significantly lower memory use compared to an earlier approach tested against the same sample PDFs. Node.js 20 or later is required. The package is released under the MIT license, with upstream BSD-style and Apache 2.0 notices for the PDFium binary.

Copy-paste prompts

Prompt 1
Show me how to use clawpdf's extractPdf function to pull text from a PDF and fall back to images if needed
Prompt 2
Help me set up clawpdf's createEngine for reuse across many requests in a Node server
Prompt 3
Explain how to use clawpdf's toMessageContent adapter to send a PDF page to a multimodal AI model
Prompt 4
Walk me through using the clawpdf CLI to extract text from a PDF in my terminal

Frequently asked questions

What is clawpdf?

A JavaScript library for extracting text and rendering pages from PDF files, built for feeding PDFs into AI models.

What language is clawpdf written in?

Mainly TypeScript. The stack also includes TypeScript, Node.js, WebAssembly.

What license does clawpdf use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is clawpdf to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is clawpdf for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.