diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml
deleted file mode 100644
index 6b0b23a..0000000
--- a/.github/workflows/npm-publish.yml
+++ /dev/null
@@ -1,67 +0,0 @@
-name: Publish NPM package
-
-on:
- push:
- branches:
- - main
-
-jobs:
- publish:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- with:
- fetch-depth: 0
-
- - name: Setup Node.js
- uses: actions/setup-node@v2
- with:
- node-version: '20'
- registry-url: 'https://registry.npmjs.org'
-
- - name: Install dependencies
- run: npm install
-
- - name: Check the version
- id: check
- run: |
- CURRENT_VERSION=$(jq -r .version package.json)
- echo "Current version: $CURRENT_VERSION"
- LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
- echo "Latest tag: $LATEST_TAG"
-
- LATEST_VERSION=${LATEST_TAG#v}
-
- if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ];
- then
- echo "Version changed"
- echo "version_changed=true" >> $GITHUB_OUTPUT
- echo "new_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
- else
- echo "Version not changed"
- echo "version_changed=false" >> $GITHUB_OUTPUT
- fi
-
- - name: Build
- run: npm run build
- if: steps.check.outputs.version_changed == 'true'
-
- - name: Publish
- if: steps.check.outputs.version_changed == 'true'
- run: npm publish --access public --no-git-checks
- env:
- NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
-
- - name: Tag release
- if: steps.check.outputs.version_changed == 'true'
- run: |
- git config --local user.email "github-actions[bot]@users.noreply.github.com"
- git config --local user.name "github-actions[bot]"
- git tag -a "v${{ steps.check.outputs.new_version }}" -m "v${{ steps.check.outputs.new_version }}"
- git push origin "v${{ steps.check.outputs.new_version }}"
-
-
-
-
-
-
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
index 6a97962..23b44a3 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2024 Utkarsh Pancholi
+Copyright (c) 2025 Javier Bagatoli
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index 953748e..4d1f54e 100644
--- a/README.md
+++ b/README.md
@@ -1,58 +1,174 @@
-# react-pdftotext
+# react-pdftotext-advanced
-Light-weight memory-safe client library for extracting plain text from pdf files.
+A browser-based PDF text extraction library that preserves the original reading experience by reconstructing paragraphs and page breaks.
-## Installing
+Unlike the original `react-pdftotext`, which returns a continuous stream of text, **react-pdftotext-advanced** analyzes the extracted content to preserve paragraph separation and page spacing, producing text that is much closer to the original document.
-Using npm:
+## Why?
-```js
-npm install react-pdftotext
+Most browser PDF extraction libraries prioritize extracting text, not readability.
+
+For example, a document like this:
+
+```text
+Good morning everyone.
+
+How are you all?
+
+I hope you're well.
```
-## Example
+may become:
-**Local File Input**
+```text
+Good morning everyone.How are you all?I hope you're well.
+```
-Now add a input tag with type="file" to take file input.
+With **react-pdftotext-advanced**, the output becomes:
-```html
-
+```text
+Good morning everyone.
+
+How are you all?
+
+I hope you're well.
```
-Import the pdf2text function from package
+This makes the extracted text much easier to:
+
+- Read
+- Display
+- Process with AI models (LLMs)
+- Index
+- Summarize
+- Search
+
+---
+
+# Features
-```js
-import pdfToText from "react-pdftotext";
+- Preserves paragraph separation.
+- Detects page endings.
+- Produces human-readable output.
+- Runs entirely in the browser.
+- No backend required.
+- Promise-based API.
+- Easy integration with React applications.
+
+---
+
+# Installation
+
+```bash
+npm install react-pdftotext-advanced
+```
+
+---
+
+# Basic Usage
+
+```tsx
+import pdfToText from "react-pdftotext-advanced";
function extractText(event) {
- const file = event.target.files[0];
- pdfToText(file)
- .then((text) => console.log(text))
- .catch((error) => console.error("Failed to extract text from pdf"));
+ const file = event.target.files[0];
+
+ pdfToText(file, "advanced")
+ .then((text) => console.log(text))
+ .catch((error) => console.error(error));
}
```
-**Remote PDF File Input**
+```html
+
+```
-For Pdf files stored at remote locations
+---
-```js
-import pdfToText from 'react-pdftotext'
+# Extraction Modes
-const pdf_url = "REMOTE_PDF_URL"
+## Simple
-function extractText() {
- const file = await fetch(pdf_url)
- .then(res => res.blob())
- .catch(error => console.error(error))
+Returns the text using the original extraction behavior.
- pdfToText(file)
- .then(text => console.log(text))
- .catch(error => console.error("Failed to extract text from pdf"))
-}
+```ts
+pdfToText(file, "simple");
+```
+
+Output
+
+```text
+Good morning everyone.How are you all?I hope you're well.
+```
+
+---
+
+## Advanced
+
+Reconstructs paragraph breaks and page spacing for improved readability.
+
+```ts
+pdfToText(file, "advanced");
+```
+
+Output
+
+```text
+Good morning everyone.
+
+How are you all?
+
+I hope you're well.
```
-## Contributing
+---
+
+# Use Cases
+
+This library is particularly useful for:
+
+- Reading letters and documents
+- AI preprocessing (LLMs)
+- Retrieval-Augmented Generation (RAG)
+- Search indexing
+- Document summarization
+- PDF viewers
+- Educational platforms
+
+---
+
+# How It Works
+
+After extracting the raw text from the PDF, the library analyzes spacing and page transitions to reconstruct the document's logical reading order.
+
+Instead of returning a continuous stream of text, it attempts to preserve the visual structure that a reader expects.
+
+---
+
+# Browser Support
+
+Supports modern browsers that are compatible with PDF.js.
+
+---
+
+# Credits
+
+This project is based on the excellent work of **react-pdftotext** and extends its functionality by improving the readability of the extracted text.
+
+---
+
+# Contributing
+
+Contributions, bug reports and feature requests are always welcome.
+
+If you have ideas for improving text reconstruction or supporting additional document layouts, feel free to open an issue or submit a pull request.
+
+---
+
+# License
-This project welcomes contributions and suggestions.
+MIT
\ No newline at end of file
diff --git a/aux-funcitons.ts b/aux-funcitons.ts
new file mode 100644
index 0000000..a016c4a
--- /dev/null
+++ b/aux-funcitons.ts
@@ -0,0 +1,17 @@
+const calculateStartLine = (controlPosX: {[key: string]: number}): number => {
+ let vectorKeys = Object.keys(controlPosX);
+ let moreUsualValue: {key:string, value: number} = {key:'', value: 0};
+
+ vectorKeys.forEach(key => {
+ if(controlPosX[key] > moreUsualValue.value){
+ moreUsualValue = {
+ key,
+ value: controlPosX[key] as number
+ }
+ }
+ })
+
+ return (Number(moreUsualValue.key)+2)
+}
+
+export default calculateStartLine;
\ No newline at end of file
diff --git a/index.ts b/index.ts
index 095fd9e..210c70d 100644
--- a/index.ts
+++ b/index.ts
@@ -1,4 +1,5 @@
import { pdfjs } from "react-pdf";
+import calculateStartLine from "./aux-funcitons";
// Path to the pdf.worker.js file
pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.mjs`;
@@ -42,4 +43,123 @@ const pdfToText = async (file: File | Blob | MediaSource): Promise => {
return extractedText;
};
-export default pdfToText;
+/**
+ * Extracts text content from a PDF file.
+ * @param {File | Blob | MediaSource} file - The PDF file to extract text from.
+ * @param lineSpacing - is space inter line an line standart
+ * @returns {Promise} A promise that resolves with the extracted text content.
+ */
+const pdfToTextLikePDF = async (file: File | Blob | MediaSource, lineSpacing: number = 1): Promise => {
+ // Create a blob URL for the PDF file
+ const blobUrl = URL.createObjectURL(file);
+
+ // Load the PDF file
+ const loadingTask = pdfjs.getDocument(blobUrl);
+
+ let extractedText = "";
+ try {
+ const pdf = await loadingTask.promise;
+ const numPages = pdf.numPages;
+
+ // Iterate through each page and extract text
+ let lastPage = 1
+
+ let sizeFontProm = 10;
+ let totalFontSize = 0;
+ let totalTokens = 0;
+
+ let controlPosX: {[key: string]: number} = {}
+ for (let pageNumber = 1; pageNumber <= numPages && pageNumber <= 5; pageNumber++) {
+ const page = await pdf.getPage(pageNumber);
+ const textContent = await page.getTextContent();
+
+ textContent.items.map((item) => {
+ if("height" in item){
+ if(item.height > 3 && item.str){
+ totalFontSize = totalFontSize + item.height;
+ totalTokens++
+ }
+
+ const name: string =(((item.transform[4]).toString()).split ('.'))[0]
+ controlPosX[name] = (controlPosX[name] || 0) + 1
+ }
+ })
+ }
+ sizeFontProm = totalFontSize/totalTokens;
+
+ const startLine = calculateStartLine(controlPosX);
+
+ for (let pageNumber = 1; pageNumber <= numPages; pageNumber++) {
+ const page = await pdf.getPage(pageNumber);
+ const textContent = await page.getTextContent();
+
+ let lastToken = ''
+ let lastLastPositionY = 0
+ let lastPositionY = 0
+
+ const pageText = textContent.items
+ .map((item, index) => {
+ if("str" in item){
+ lastToken = ''
+
+ lastLastPositionY = lastPositionY
+ lastPositionY = item.transform[5]
+
+ //Encabezado
+ if(lastLastPositionY >= 790){
+ lastToken = '\n'
+ }
+ //Is end of Page?
+ if(lastPage < pageNumber && pageNumber !== 1){
+ lastToken = '\n',
+ lastPage++
+ }
+
+ //Is end of line
+ if(index > 1 && (lastLastPositionY-(sizeFontProm*1.6*lineSpacing) > item.transform[5])){
+ lastToken = '\n'
+ }
+
+ //Is new parrafo
+ if(lastLastPositionY-(sizeFontProm*lineSpacing) > item.transform[5]
+ && item.transform[4] > startLine
+ ){
+ lastToken = '\n'
+ }
+
+ //Is a foot of page
+ if((index > 0 && lastLastPositionY < item.transform[5] )){
+ lastToken = '\n'
+ }
+
+ //Is a jump
+ if(lastPositionY === 0){
+ lastToken = '\n'
+ }
+
+ return lastToken + (item.str === ''? ' ': '') + item.str
+ }})
+ .join('');
+ extractedText += pageText;
+ }
+ } catch (error) {
+ throw new Error(`Failed to extract text from PDF: ${error}`);
+ } finally {
+ // Clean up the blob URL
+ URL.revokeObjectURL(blobUrl);
+
+ // Free memory from loading task
+ loadingTask.destroy();
+ }
+ return extractedText;
+};
+
+const selectModeToExtract = async (file: File | Blob | MediaSource, mode: 'simple' | 'advanced', lineSpacing: number = 1): Promise => {
+ if (mode === 'simple') {
+ return pdfToText(file);
+ } else {
+ return pdfToTextLikePDF(file,lineSpacing);
+ }
+}
+
+export default selectModeToExtract;
diff --git a/package-lock.json b/package-lock.json
index 40b68ea..a7b71b6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "react-pdftotext",
- "version": "1.3.4",
+ "version": "1.3.9",
"lockfileVersion": 3,
"requires": true,
"packages": {
diff --git a/package.json b/package.json
index 31eb6b4..658df14 100644
--- a/package.json
+++ b/package.json
@@ -1,10 +1,16 @@
{
- "name": "react-pdftotext",
- "version": "1.3.4",
+ "name": "react-pdftotext-advanced",
+ "version": "1.3.9",
"description": "A simple light weight react package to extract plain text from a pdf file.",
- "main": "dist/index.js",
- "module": "dist/index.js",
+ "main": "./dist/index.js",
"types": "dist/index.d.ts",
+ "type": "module",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.ts",
+ "import": "./dist/index.js"
+ }
+ },
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc",
@@ -12,7 +18,7 @@
},
"repository": {
"type": "git",
- "url": "https://github.com/Utkarsh212/react-pdftotext.git"
+ "url": "https://github.com/JavierBagatoli/react-pdftotext.git"
},
"keywords": [
"react-pdf",
@@ -22,9 +28,10 @@
"react",
"pdf2text",
"pdfjs",
- "pdf-to-text"
+ "pdf-to-text",
+ "typescript"
],
- "author": "Utkarsh Pancholi",
+ "author": "Javier Bagatoli",
"license": "MIT",
"dependencies": {
"pdfjs-dist": "^4.6.82",
@@ -34,3 +41,5 @@
"typescript": "^5.4.5"
}
}
+
+
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
new file mode 100644
index 0000000..d1e3a9e
--- /dev/null
+++ b/pnpm-lock.yaml
@@ -0,0 +1,579 @@
+lockfileVersion: '9.0'
+
+settings:
+ autoInstallPeers: true
+ excludeLinksFromLockfile: false
+
+importers:
+
+ .:
+ dependencies:
+ pdfjs-dist:
+ specifier: ^4.6.82
+ version: 4.10.38
+ react-pdf:
+ specifier: ^9.1.1
+ version: 9.2.1(react-dom@19.2.8(react@19.2.8))(react@19.2.8)
+ devDependencies:
+ typescript:
+ specifier: ^5.4.5
+ version: 5.9.3
+
+packages:
+
+ '@napi-rs/canvas-android-arm64@0.1.100':
+ resolution: {integrity: sha512-hjhCKhntPv9+t4ckHymdx0phYNcVW+GKQR6Lzw2zE+pOVjOplSmtx9nNNknTjbEDLcuLZqA1y8ufKg1XfgftzQ==}
+ engines: {node: '>= 10'}
+ cpu: [arm64]
+ os: [android]
+
+ '@napi-rs/canvas-darwin-arm64@0.1.100':
+ resolution: {integrity: sha512-2PcswRaC7Ly645DGt88///zuFDhJxJYdKAs1uU3mfk1atYkXufgcgLfBpk6Tm12nCQBaNt1wpybuPZ4qOhTo8A==}
+ engines: {node: '>= 10'}
+ cpu: [arm64]
+ os: [darwin]
+
+ '@napi-rs/canvas-darwin-x64@0.1.100':
+ resolution: {integrity: sha512-ePNZtj7pNIva/siZMg+HmbeozkIjqUIYdoymH8HaA3qK7LfzFN4WMBM8G6HQ9ZC+H3+Dnn5pqtiXpgLykaPOhw==}
+ engines: {node: '>= 10'}
+ cpu: [x64]
+ os: [darwin]
+
+ '@napi-rs/canvas-linux-arm-gnueabihf@0.1.100':
+ resolution: {integrity: sha512-d5cDB48oWFGU8/XPhUOFAlySgb/VAu7D+s8fi55K1Pcfg8aPplHWqMgibhVLU8ky7Pyg/fuiVLz4Nf3JrSTuUA==}
+ engines: {node: '>= 10'}
+ cpu: [arm]
+ os: [linux]
+
+ '@napi-rs/canvas-linux-arm64-gnu@0.1.100':
+ resolution: {integrity: sha512-rDxgxRu69RvDlX/bh9o22DxLsGr8EqsNgotL9+RwQE1S0b0cqeatqsw6aW45mukm0B42DIAaAacKaYQ8cqS1nw==}
+ engines: {node: '>= 10'}
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
+ '@napi-rs/canvas-linux-arm64-musl@0.1.100':
+ resolution: {integrity: sha512-K3mDW66N+xT2/V439u1alFANiBUjdEx2gLiNYnCmUsva5jZMxWTjafBYwTzYK+EMFMHrUoabuU+T1BIP5CgbYQ==}
+ engines: {node: '>= 10'}
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
+ '@napi-rs/canvas-linux-riscv64-gnu@0.1.100':
+ resolution: {integrity: sha512-mooqUBTIsccZpnoQC4NgrC1v6C1vof39etLNMnBwCY+p0gajWJvAHLGQ6g/gGyS5YrpDW+GefSN4+Cvcr08UWw==}
+ engines: {node: '>= 10'}
+ cpu: [riscv64]
+ os: [linux]
+ libc: [glibc]
+
+ '@napi-rs/canvas-linux-x64-gnu@0.1.100':
+ resolution: {integrity: sha512-1eCvkDCazm7FFhsT7DfGOdSaHgZVK3bt/dSBl5EWHOWmnz+I7j8tPseJqqD81NF+MH21jKUK4wQSDjN0mdhnTg==}
+ engines: {node: '>= 10'}
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
+ '@napi-rs/canvas-linux-x64-musl@0.1.100':
+ resolution: {integrity: sha512-20arT6lnI19S68qNlii73TSEDbECNgzMz2EpldC1V3mZFuRkeujXkcebRk0LRJe9SEUAooYiLokfMViY8IX7yA==}
+ engines: {node: '>= 10'}
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
+ '@napi-rs/canvas-win32-arm64-msvc@0.1.100':
+ resolution: {integrity: sha512-DZFFT1wIAg37LJw37yhMRFfjATd3vTQzjZ1Yki8u2vhO6Hi5VE6BVaGQ1aaDu7xb4iMErz+9EOwjpS7xcxFeBw==}
+ engines: {node: '>= 10'}
+ cpu: [arm64]
+ os: [win32]
+
+ '@napi-rs/canvas-win32-x64-msvc@0.1.100':
+ resolution: {integrity: sha512-MyT1j3mHC2+Lu4pBi9mKyMJhtP6U7k7EldY7sj/uS5gJA65gTXt8MefJQXLJo5d/vZbuWmfxzkEUNc/urV3pHA==}
+ engines: {node: '>= 10'}
+ cpu: [x64]
+ os: [win32]
+
+ '@napi-rs/canvas@0.1.100':
+ resolution: {integrity: sha512-xglYA6q3XO5P3BNJYxVZ1IV7DLVjp1Py6nwag88YntrS+3vKHyYcMqXVS4ZztJmwz2uGvz1FWhI/4LgbR5uQDA==}
+ engines: {node: '>= 10'}
+
+ base64-js@1.5.1:
+ resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
+
+ bl@4.1.0:
+ resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==}
+
+ buffer@5.7.1:
+ resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==}
+
+ canvas@3.2.3:
+ resolution: {integrity: sha512-PzE5nJZPz72YUAfo8oTp0u3fqqY7IzlTubneAihqDYAUcBk7ryeCmBbdJBEdaH0bptSOe2VT2Zwcb3UaFyaSWw==}
+ engines: {node: ^18.12.0 || >= 20.9.0}
+
+ chownr@1.1.4:
+ resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==}
+
+ clsx@2.1.1:
+ resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==}
+ engines: {node: '>=6'}
+
+ decompress-response@6.0.0:
+ resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==}
+ engines: {node: '>=10'}
+
+ deep-extend@0.6.0:
+ resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==}
+ engines: {node: '>=4.0.0'}
+
+ dequal@2.0.3:
+ resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}
+ engines: {node: '>=6'}
+
+ detect-libc@2.1.2:
+ resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}
+ engines: {node: '>=8'}
+
+ end-of-stream@1.4.5:
+ resolution: {integrity: sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==}
+
+ expand-template@2.0.3:
+ resolution: {integrity: sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==}
+ engines: {node: '>=6'}
+
+ fs-constants@1.0.0:
+ resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==}
+
+ github-from-package@0.0.0:
+ resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==}
+
+ ieee754@1.2.1:
+ resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==}
+
+ inherits@2.0.4:
+ resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
+
+ ini@1.3.8:
+ resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==}
+
+ js-tokens@4.0.0:
+ resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
+
+ loose-envify@1.4.0:
+ resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==}
+ hasBin: true
+
+ make-cancellable-promise@1.3.2:
+ resolution: {integrity: sha512-GCXh3bq/WuMbS+Ky4JBPW1hYTOU+znU+Q5m9Pu+pI8EoUqIHk9+tviOKC6/qhHh8C4/As3tzJ69IF32kdz85ww==}
+
+ make-event-props@1.6.2:
+ resolution: {integrity: sha512-iDwf7mA03WPiR8QxvcVHmVWEPfMY1RZXerDVNCRYW7dUr2ppH3J58Rwb39/WG39yTZdRSxr3x+2v22tvI0VEvA==}
+
+ merge-refs@1.3.0:
+ resolution: {integrity: sha512-nqXPXbso+1dcKDpPCXvwZyJILz+vSLqGGOnDrYHQYE+B8n9JTCekVLC65AfCpR4ggVyA/45Y0iR9LDyS2iI+zA==}
+ peerDependencies:
+ '@types/react': ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+
+ mimic-response@3.1.0:
+ resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==}
+ engines: {node: '>=10'}
+
+ minimist@1.2.8:
+ resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
+
+ mkdirp-classic@0.5.3:
+ resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==}
+
+ napi-build-utils@2.0.0:
+ resolution: {integrity: sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==}
+
+ node-abi@3.94.0:
+ resolution: {integrity: sha512-W5ZNO5KRPB5TkYmGVD9F6YqhsglXJzE6etpbmT+f6EQElhiX/UTG551cnsRGvLG3fyZEg9HwaDmNmj5nwJ4z9g==}
+ engines: {node: '>=10'}
+
+ node-addon-api@7.1.1:
+ resolution: {integrity: sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==}
+
+ once@1.4.0:
+ resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
+
+ path2d@0.2.2:
+ resolution: {integrity: sha512-+vnG6S4dYcYxZd+CZxzXCNKdELYZSKfohrk98yajCo1PtRoDgCTrrwOvK1GT0UoAdVszagDVllQc0U1vaX4NUQ==}
+ engines: {node: '>=6'}
+
+ pdfjs-dist@4.10.38:
+ resolution: {integrity: sha512-/Y3fcFrXEAsMjJXeL9J8+ZG9U01LbuWaYypvDW2ycW1jL269L3js3DVBjDJ0Up9Np1uqDXsDrRihHANhZOlwdQ==}
+ engines: {node: '>=20'}
+
+ pdfjs-dist@4.8.69:
+ resolution: {integrity: sha512-IHZsA4T7YElCKNNXtiLgqScw4zPd3pG9do8UrznC757gMd7UPeHSL2qwNNMJo4r79fl8oj1Xx+1nh2YkzdMpLQ==}
+ engines: {node: '>=18'}
+
+ prebuild-install@7.1.3:
+ resolution: {integrity: sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==}
+ engines: {node: '>=10'}
+ deprecated: No longer maintained. Please contact the author of the relevant native addon; alternatives are available.
+ hasBin: true
+
+ pump@3.0.4:
+ resolution: {integrity: sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==}
+
+ rc@1.2.8:
+ resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==}
+ hasBin: true
+
+ react-dom@19.2.8:
+ resolution: {integrity: sha512-rVprimfGBG3DR+Tq0IQG2DT5PxKth1WIGDmj5yPmlzr4YBe7uyE+Du4oVqTDXZSHGGGXRtTJEGSSePyQCMBglQ==}
+ peerDependencies:
+ react: ^19.2.8
+
+ react-pdf@9.2.1:
+ resolution: {integrity: sha512-AJt0lAIkItWEZRA5d/mO+Om4nPCuTiQ0saA+qItO967DTjmGjnhmF+Bi2tL286mOTfBlF5CyLzJ35KTMaDoH+A==}
+ peerDependencies:
+ '@types/react': ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
+ react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
+ react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+
+ react@19.2.8:
+ resolution: {integrity: sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw==}
+ engines: {node: '>=0.10.0'}
+
+ readable-stream@3.6.2:
+ resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==}
+ engines: {node: '>= 6'}
+
+ safe-buffer@5.2.1:
+ resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
+
+ scheduler@0.27.0:
+ resolution: {integrity: sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==}
+
+ semver@7.8.5:
+ resolution: {integrity: sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==}
+ engines: {node: '>=10'}
+ hasBin: true
+
+ simple-concat@1.0.1:
+ resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==}
+
+ simple-get@4.0.1:
+ resolution: {integrity: sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==}
+
+ string_decoder@1.3.0:
+ resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==}
+
+ strip-json-comments@2.0.1:
+ resolution: {integrity: sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==}
+ engines: {node: '>=0.10.0'}
+
+ tar-fs@2.1.5:
+ resolution: {integrity: sha512-OboTd8mmMhZDNPV+UjQcK9yKAatXu2aJ+r1w4im1Otd4M4fl2hwvdoXUxIYHFTHWK/3y3FarBP70v3vwmGlOxw==}
+
+ tar-stream@2.2.0:
+ resolution: {integrity: sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==}
+ engines: {node: '>=6'}
+
+ tiny-invariant@1.3.3:
+ resolution: {integrity: sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==}
+
+ tunnel-agent@0.6.0:
+ resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==}
+
+ typescript@5.9.3:
+ resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
+ engines: {node: '>=14.17'}
+ hasBin: true
+
+ util-deprecate@1.0.2:
+ resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
+
+ warning@4.0.3:
+ resolution: {integrity: sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==}
+
+ wrappy@1.0.2:
+ resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
+
+snapshots:
+
+ '@napi-rs/canvas-android-arm64@0.1.100':
+ optional: true
+
+ '@napi-rs/canvas-darwin-arm64@0.1.100':
+ optional: true
+
+ '@napi-rs/canvas-darwin-x64@0.1.100':
+ optional: true
+
+ '@napi-rs/canvas-linux-arm-gnueabihf@0.1.100':
+ optional: true
+
+ '@napi-rs/canvas-linux-arm64-gnu@0.1.100':
+ optional: true
+
+ '@napi-rs/canvas-linux-arm64-musl@0.1.100':
+ optional: true
+
+ '@napi-rs/canvas-linux-riscv64-gnu@0.1.100':
+ optional: true
+
+ '@napi-rs/canvas-linux-x64-gnu@0.1.100':
+ optional: true
+
+ '@napi-rs/canvas-linux-x64-musl@0.1.100':
+ optional: true
+
+ '@napi-rs/canvas-win32-arm64-msvc@0.1.100':
+ optional: true
+
+ '@napi-rs/canvas-win32-x64-msvc@0.1.100':
+ optional: true
+
+ '@napi-rs/canvas@0.1.100':
+ optionalDependencies:
+ '@napi-rs/canvas-android-arm64': 0.1.100
+ '@napi-rs/canvas-darwin-arm64': 0.1.100
+ '@napi-rs/canvas-darwin-x64': 0.1.100
+ '@napi-rs/canvas-linux-arm-gnueabihf': 0.1.100
+ '@napi-rs/canvas-linux-arm64-gnu': 0.1.100
+ '@napi-rs/canvas-linux-arm64-musl': 0.1.100
+ '@napi-rs/canvas-linux-riscv64-gnu': 0.1.100
+ '@napi-rs/canvas-linux-x64-gnu': 0.1.100
+ '@napi-rs/canvas-linux-x64-musl': 0.1.100
+ '@napi-rs/canvas-win32-arm64-msvc': 0.1.100
+ '@napi-rs/canvas-win32-x64-msvc': 0.1.100
+ optional: true
+
+ base64-js@1.5.1:
+ optional: true
+
+ bl@4.1.0:
+ dependencies:
+ buffer: 5.7.1
+ inherits: 2.0.4
+ readable-stream: 3.6.2
+ optional: true
+
+ buffer@5.7.1:
+ dependencies:
+ base64-js: 1.5.1
+ ieee754: 1.2.1
+ optional: true
+
+ canvas@3.2.3:
+ dependencies:
+ node-addon-api: 7.1.1
+ prebuild-install: 7.1.3
+ optional: true
+
+ chownr@1.1.4:
+ optional: true
+
+ clsx@2.1.1: {}
+
+ decompress-response@6.0.0:
+ dependencies:
+ mimic-response: 3.1.0
+ optional: true
+
+ deep-extend@0.6.0:
+ optional: true
+
+ dequal@2.0.3: {}
+
+ detect-libc@2.1.2:
+ optional: true
+
+ end-of-stream@1.4.5:
+ dependencies:
+ once: 1.4.0
+ optional: true
+
+ expand-template@2.0.3:
+ optional: true
+
+ fs-constants@1.0.0:
+ optional: true
+
+ github-from-package@0.0.0:
+ optional: true
+
+ ieee754@1.2.1:
+ optional: true
+
+ inherits@2.0.4:
+ optional: true
+
+ ini@1.3.8:
+ optional: true
+
+ js-tokens@4.0.0: {}
+
+ loose-envify@1.4.0:
+ dependencies:
+ js-tokens: 4.0.0
+
+ make-cancellable-promise@1.3.2: {}
+
+ make-event-props@1.6.2: {}
+
+ merge-refs@1.3.0: {}
+
+ mimic-response@3.1.0:
+ optional: true
+
+ minimist@1.2.8:
+ optional: true
+
+ mkdirp-classic@0.5.3:
+ optional: true
+
+ napi-build-utils@2.0.0:
+ optional: true
+
+ node-abi@3.94.0:
+ dependencies:
+ semver: 7.8.5
+ optional: true
+
+ node-addon-api@7.1.1:
+ optional: true
+
+ once@1.4.0:
+ dependencies:
+ wrappy: 1.0.2
+ optional: true
+
+ path2d@0.2.2:
+ optional: true
+
+ pdfjs-dist@4.10.38:
+ optionalDependencies:
+ '@napi-rs/canvas': 0.1.100
+
+ pdfjs-dist@4.8.69:
+ optionalDependencies:
+ canvas: 3.2.3
+ path2d: 0.2.2
+
+ prebuild-install@7.1.3:
+ dependencies:
+ detect-libc: 2.1.2
+ expand-template: 2.0.3
+ github-from-package: 0.0.0
+ minimist: 1.2.8
+ mkdirp-classic: 0.5.3
+ napi-build-utils: 2.0.0
+ node-abi: 3.94.0
+ pump: 3.0.4
+ rc: 1.2.8
+ simple-get: 4.0.1
+ tar-fs: 2.1.5
+ tunnel-agent: 0.6.0
+ optional: true
+
+ pump@3.0.4:
+ dependencies:
+ end-of-stream: 1.4.5
+ once: 1.4.0
+ optional: true
+
+ rc@1.2.8:
+ dependencies:
+ deep-extend: 0.6.0
+ ini: 1.3.8
+ minimist: 1.2.8
+ strip-json-comments: 2.0.1
+ optional: true
+
+ react-dom@19.2.8(react@19.2.8):
+ dependencies:
+ react: 19.2.8
+ scheduler: 0.27.0
+
+ react-pdf@9.2.1(react-dom@19.2.8(react@19.2.8))(react@19.2.8):
+ dependencies:
+ clsx: 2.1.1
+ dequal: 2.0.3
+ make-cancellable-promise: 1.3.2
+ make-event-props: 1.6.2
+ merge-refs: 1.3.0
+ pdfjs-dist: 4.8.69
+ react: 19.2.8
+ react-dom: 19.2.8(react@19.2.8)
+ tiny-invariant: 1.3.3
+ warning: 4.0.3
+
+ react@19.2.8: {}
+
+ readable-stream@3.6.2:
+ dependencies:
+ inherits: 2.0.4
+ string_decoder: 1.3.0
+ util-deprecate: 1.0.2
+ optional: true
+
+ safe-buffer@5.2.1:
+ optional: true
+
+ scheduler@0.27.0: {}
+
+ semver@7.8.5:
+ optional: true
+
+ simple-concat@1.0.1:
+ optional: true
+
+ simple-get@4.0.1:
+ dependencies:
+ decompress-response: 6.0.0
+ once: 1.4.0
+ simple-concat: 1.0.1
+ optional: true
+
+ string_decoder@1.3.0:
+ dependencies:
+ safe-buffer: 5.2.1
+ optional: true
+
+ strip-json-comments@2.0.1:
+ optional: true
+
+ tar-fs@2.1.5:
+ dependencies:
+ chownr: 1.1.4
+ mkdirp-classic: 0.5.3
+ pump: 3.0.4
+ tar-stream: 2.2.0
+ optional: true
+
+ tar-stream@2.2.0:
+ dependencies:
+ bl: 4.1.0
+ end-of-stream: 1.4.5
+ fs-constants: 1.0.0
+ inherits: 2.0.4
+ readable-stream: 3.6.2
+ optional: true
+
+ tiny-invariant@1.3.3: {}
+
+ tunnel-agent@0.6.0:
+ dependencies:
+ safe-buffer: 5.2.1
+ optional: true
+
+ typescript@5.9.3: {}
+
+ util-deprecate@1.0.2:
+ optional: true
+
+ warning@4.0.3:
+ dependencies:
+ loose-envify: 1.4.0
+
+ wrappy@1.0.2:
+ optional: true
diff --git a/tsconfig.json b/tsconfig.json
index 6777d45..c658171 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -2,15 +2,14 @@
"files": ["index.ts"],
"compilerOptions": {
"allowJs": true,
- "declaration": true,
"outDir": "dist",
- "esModuleInterop": true,
"isolatedModules": true,
- "module": "NodeNext",
+ "target": "ES2020",
+ "module": "ESNext",
+ "declaration": true,
+ "esModuleInterop": true,
+ "moduleResolution": "Node",
"skipLibCheck": true,
-
- // This matches the TypeScript target used by react-pdf:
- // https://github.com/wojtekmaj/react-pdf/blob/main/packages/react-pdf/tsconfig.json
- "target": "ES2015"
- }
+ },
+ "include": ["src/**/*", "index.ts", "aux-funcitons.ts"]
}
\ No newline at end of file