thinkpdf 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # thinkpdf
2
+
3
+ > **Note:** This is a Node.js wrapper for the Python `thinkpdf` package. Requires Python 3.10+.
4
+
5
+ Extract text, tables, and structure from PDFs. Built for RAG pipelines, AI training, and LLM context.
6
+
7
+ Read directly into memory or save as Markdown.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install -g thinkpdf
13
+ ```
14
+
15
+ This will automatically install the Python package via pip.
16
+
17
+ ## Quick Start
18
+
19
+ ```bash
20
+ thinkpdf document.pdf # outputs document.md
21
+ thinkpdf document.pdf -o output.md # custom output
22
+ thinkpdf folder/ --batch # convert all PDFs
23
+ ```
24
+
25
+ ## MCP Server
26
+
27
+ Add to your MCP config:
28
+
29
+ ```json
30
+ {
31
+ "mcpServers": {
32
+ "thinkpdf": {
33
+ "command": "python",
34
+ "args": ["-m", "thinkpdf.mcp_server"]
35
+ }
36
+ }
37
+ }
38
+ ```
39
+
40
+ | Tool | Description |
41
+ |------|-------------|
42
+ | `read_pdf` | Read PDF content into context |
43
+ | `convert_pdf` | Convert and save to file |
44
+ | `get_document_info` | Get PDF metadata |
45
+
46
+ ## License
47
+
48
+ AGPL-3.0
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawnSync } = require('child_process');
4
+
5
+ let pythonCmd = 'python';
6
+ let pipCmd = 'pip';
7
+
8
+ let pythonCheck = spawnSync('python', ['--version']);
9
+ if (pythonCheck.error || pythonCheck.status !== 0) {
10
+ pythonCheck = spawnSync('python3', ['--version']);
11
+ if (pythonCheck.error || pythonCheck.status !== 0) {
12
+ console.error('Error: Python is not installed or not in PATH.');
13
+ console.error('Please install Python 3.10+ to use thinkpdf.');
14
+ process.exit(1);
15
+ }
16
+ pythonCmd = 'python3';
17
+ pipCmd = 'pip3';
18
+ }
19
+
20
+ const pipCheck = spawnSync(pipCmd, ['show', 'thinkpdf']);
21
+ if (pipCheck.status !== 0) {
22
+ console.log('thinkpdf python package not found. Installing via pip...');
23
+ const install = spawnSync(pipCmd, ['install', 'thinkpdf'], { stdio: 'inherit' });
24
+ if (install.status !== 0) {
25
+ console.error('Failed to install thinkpdf via pip.');
26
+ process.exit(1);
27
+ }
28
+ }
29
+
30
+ const args = process.argv.slice(2);
31
+ const result = spawnSync(pythonCmd, ['-m', 'thinkpdf', ...args], { stdio: 'inherit' });
32
+
33
+ process.exit(result.status);
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "thinkpdf",
3
+ "version": "1.0.4",
4
+ "description": "NPM wrapper for thinkpdf - The PDF to Markdown converter for LLMs",
5
+ "bin": {
6
+ "thinkpdf": "./bin/thinkpdf.js"
7
+ },
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "keywords": [
12
+ "pdf",
13
+ "markdown",
14
+ "llm",
15
+ "ai",
16
+ "converter",
17
+ "wrapper"
18
+ ],
19
+ "author": "Augusto Cesar Perin",
20
+ "license": "AGPL-3.0",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/augustocesarperin/thinkpdf"
24
+ },
25
+ "homepage": "https://pypi.org/project/thinkpdf/"
26
+ }