@markitdownjs/pdf 0.1.0 → 0.1.1

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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +57 -0
  3. package/package.json +3 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 MarkItDownJS Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # @markitdownjs/pdf
2
+
3
+ [![npm](https://img.shields.io/npm/v/@markitdownjs/pdf)](https://www.npmjs.com/package/@markitdownjs/pdf)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ PDF to AST converter for MarkItDownJS, powered by `pdfjs-dist`. Extracts text content, document structure, metadata, and page information.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ npm install @markitdownjs/pdf
12
+ ```
13
+
14
+ `pdfjs-dist` is a peer dependency and will be installed automatically.
15
+
16
+ ## Usage
17
+
18
+ ```ts
19
+ import { MarkItDown } from "@markitdownjs/core";
20
+ import { PdfConverter } from "@markitdownjs/pdf";
21
+
22
+ const parser = new MarkItDown();
23
+ parser.registerConverter(new PdfConverter());
24
+
25
+ const result = await parser.convert({ source: pdfBuffer, mimeType: "application/pdf" });
26
+ console.log(result.markdown);
27
+ ```
28
+
29
+ ## Key Exports
30
+
31
+ | Export | Description |
32
+ |---|---|
33
+ | `PdfConverter` | Converter plugin — register with `MarkItDown` |
34
+
35
+ ## What Gets Extracted
36
+
37
+ - Text content with paragraph and heading detection
38
+ - Page boundaries (preserved as `pageNumber` in AST nodes)
39
+ - Document metadata: title, author, creation date, subject
40
+ - Multi-column layout heuristics
41
+
42
+ ## Options
43
+
44
+ ```ts
45
+ parser.registerConverter(new PdfConverter({
46
+ extractMetadata: true,
47
+ preservePageBreaks: true,
48
+ }));
49
+ ```
50
+
51
+ ## Accepted MIME Types
52
+
53
+ - `application/pdf`
54
+
55
+ ---
56
+
57
+ Part of the [MarkItDownJS](https://github.com/markitdownjs/markitdownjs) monorepo.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markitdownjs/pdf",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "PDF converter for MarkItDownJS",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -18,8 +18,8 @@
18
18
  ],
19
19
  "dependencies": {
20
20
  "pdfjs-dist": "^4.0.0",
21
- "@markitdownjs/shared": "0.1.0",
22
- "@markitdownjs/ast": "0.1.0"
21
+ "@markitdownjs/ast": "0.1.1",
22
+ "@markitdownjs/shared": "0.1.1"
23
23
  },
24
24
  "devDependencies": {
25
25
  "typescript": "^5.5.0"