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

@dragon708/docmind-pdf

v2.3.0

Published

Basic PDF text and metadata for DocMind (pdf-parse). Per-page text, outline, links, and annotations via pdfjs-dist. AcroForm listing, fill, and flatten via pdf-lib. Optional OCR pipeline via @dragon708/docmind-pdf/pipeline.

Readme

@dragon708/docmind-pdf

PDF para DocMind: texto nativo y metadatos (pdf-parse), texto y estructura con PDF.js (por página, outline, enlaces, anotaciones), formularios AcroForm con pdf-lib (listar, rellenar, aplanar), manipulación básica (insertar/paginar/partir/merge) y extractStructuredDataFromPdf, que construye StructuredDocumentResult. Opcionalmente, pipeline OCR sobre rasters en submódulo @dragon708/docmind-pdf/pipeline (integración con @dragon708/docmind-ocr).

Requisito: Node ≥ 20 (motores pdfjs / entorno).


Instalación

npm install @dragon708/docmind-pdf

Depende de @dragon708/docmind-ocr para el pipeline raster. No uses este paquete en bundles browser estándar salvo que configures pdfjs/workers explícitamente; en apps web suele procesarse PDF en servidor (@dragon708/docmind-node).


Exportaciones del entry principal (@dragon708/docmind-pdf)

Análisis y texto

import {
  analyzePdf,
  extractTextFromPdf,
  extractPdfMetadata,
  getPdfPageCount,
  type PdfAnalyzeOptions,
  type PdfAnalysisResult,
} from "@dragon708/docmind-pdf";

const analysis = await analyzePdf(buffer, { ocr: "auto" /* … */ });
const meta = await extractPdfMetadata(buffer);
const pages = await getPdfPageCount(buffer);

Documento estructurado

import {
  extractStructuredDataFromPdf,
  type ExtractStructuredDataFromPdfOptions,
  type ExtractStructuredDataFromPdfIncludeFlags,
} from "@dragon708/docmind-pdf";

const structured = await extractStructuredDataFromPdf(buffer, {
  include: { outline: true, links: true, annotations: true },
  ocr: "auto",
});

Texto por página (PDF.js)

import {
  extractPdfTextByPage,
  extractPdfPages,
  type ExtractPdfByPageOptions,
} from "@dragon708/docmind-pdf";

const byPage = await extractPdfTextByPage(buffer, { maxPages: 50 });
const pageBodies = await extractPdfPages(buffer, options);

Outline, enlaces, anotaciones

import {
  extractPdfOutline,
  extractPdfLinks,
  extractPdfAnnotations,
} from "@dragon708/docmind-pdf";

const outline = await extractPdfOutline(buffer);
const links = await extractPdfLinks(buffer);
const annotations = await extractPdfAnnotations(buffer);

Formularios (pdf-lib)

import {
  getPdfFormFields,
  fillPdfForm,
  flattenPdfForm,
  type PdfFormFillValues,
} from "@dragon708/docmind-pdf";

const fields = await getPdfFormFields(buffer);
await fillPdfForm(buffer, { campo: "valor" } as PdfFormFillValues);
await flattenPdfForm(buffer);

Manipulación

import {
  mergePdf,
  splitPdf,
  insertPdfPages,
  removePdfPages,
  type SplitPdfOptions,
  type InsertPdfPagesOptions,
} from "@dragon708/docmind-pdf";

Estrategia OCR del pipeline PDF

import type { PdfOcrPipelineStrategy } from "@dragon708/docmind-pdf";
// "native-first" | "ocr-only" | "hybrid"

Submódulo @dragon708/docmind-pdf/pipeline

import { runPdfOcrPipeline } from "@dragon708/docmind-pdf/pipeline";

// Rasteriza / elige estrategia nativa vs OCR según opciones

Úsalo cuando la API pública de Node (analyzeFile, runOcr) no baste y necesites control fino del pipeline en servidor.


Tipos y opciones frecuentes

  • PdfBinaryInput: buffer + nombre/MIME opcionales.
  • PdfAnalyzeOptions: ocr, maxPages, ocrStrategy, idiomas, señales de abort, etc.
  • ExtractPdfByPageOptions, ExtractPdfStructureOptions: flags de inclusión para outline/links/anotaciones.
  • Resultados tipados: PdfOutlineResult, PdfLinksResult, PdfAnnotationsResult, GetPdfFormFieldsResult, etc.

Integración con Markdown

@dragon708/docmind-markdown convierte PDF a Markdown en Node (con fallback estructurado cuando aplica); ese camino se alimenta del análisis PDF y del texto/layout expuesto aquí y en el paquete markdown. Este paquete no reexporta extractMarkdown.


Errores y PDF corruptos

PDF inválidos o cifrados pueden fallar con errores de pdf-parse/pdf-lib/pdfjs. Captura y muestra message; DocMind a veces envuelve en DocMindError aguas arriba.


Paquetes relacionados

| Paquete | Rol | |---------|-----| | @dragon708/docmind-node | API pública analyzeFile / extractStructuredData PDF | | @dragon708/docmind-ocr | Tesseract en pipeline | | @dragon708/docmind-markdown | PDF → Markdown en Node | | @dragon708/docmind-shared | Tipos |


Licencia

MIT (monorepo DocMind).