markitdown-pdfluent 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,25 @@
1
+ """MarkItDown plugin: PDFs to Markdown with the PDFluent engine."""
2
+
3
+ # Copyright (c) 2026 Innovation Trigger B.V.
4
+ #
5
+ # Licensed under the MIT License. See the LICENSE file in this repository.
6
+
7
+ from __future__ import annotations
8
+
9
+ from typing import Any
10
+
11
+ from markitdown import MarkItDown
12
+
13
+ from ._converter import PDFluentPdfConverter
14
+
15
+ __plugin_interface_version__ = 1
16
+
17
+ # Lower values run first. MarkItDown's built-in PDF converter uses 0, so this runs before it.
18
+ PRIORITY = -1.0
19
+
20
+ __all__ = ["PDFluentPdfConverter", "register_converters"]
21
+
22
+
23
+ def register_converters(markitdown: MarkItDown, **kwargs: Any) -> None:
24
+ """Called by MarkItDown when plugins are enabled."""
25
+ markitdown.register_converter(PDFluentPdfConverter(), priority=PRIORITY)
@@ -0,0 +1,41 @@
1
+ # Copyright (c) 2026 Innovation Trigger B.V.
2
+ #
3
+ # Licensed under the MIT License. See the LICENSE file in this repository.
4
+
5
+ from __future__ import annotations
6
+
7
+ from typing import Any, BinaryIO
8
+
9
+ from markitdown import DocumentConverter, DocumentConverterResult, StreamInfo
10
+
11
+ _PDF_EXTENSIONS = (".pdf",)
12
+ _PDF_MIMETYPES = ("application/pdf", "application/x-pdf")
13
+ _PDF_MAGIC = b"%PDF-"
14
+
15
+
16
+ class PDFluentPdfConverter(DocumentConverter):
17
+ """Converts PDF streams to Markdown with the local PDFluent engine."""
18
+
19
+ def accepts(self, file_stream: BinaryIO, stream_info: StreamInfo, **kwargs: Any) -> bool:
20
+ extension = (stream_info.extension or "").lower()
21
+ mimetype = (stream_info.mimetype or "").lower()
22
+ if extension in _PDF_EXTENSIONS or mimetype.startswith(_PDF_MIMETYPES):
23
+ return True
24
+ # No hint from the caller: look at the first bytes, then put the stream back.
25
+ if not extension and not mimetype and file_stream.seekable():
26
+ position = file_stream.tell()
27
+ try:
28
+ return file_stream.read(len(_PDF_MAGIC)) == _PDF_MAGIC
29
+ finally:
30
+ file_stream.seek(position)
31
+ return False
32
+
33
+ def convert(
34
+ self, file_stream: BinaryIO, stream_info: StreamInfo, **kwargs: Any
35
+ ) -> DocumentConverterResult:
36
+ from pdfluent import Document
37
+
38
+ document = Document(file_stream.read())
39
+ with document:
40
+ markdown = document.extract_markdown()
41
+ return DocumentConverterResult(markdown=markdown.strip() + "\n")
@@ -0,0 +1,61 @@
1
+ Metadata-Version: 2.5
2
+ Name: markitdown-pdfluent
3
+ Version: 0.1.0
4
+ Summary: A MarkItDown plugin that converts PDFs to Markdown with the PDFluent engine: reading order, headings, lists and tables, locally and offline.
5
+ Project-URL: Homepage, https://pdfluent.com
6
+ Project-URL: Documentation, https://pdfluent.com/docs
7
+ Project-URL: Repository, https://github.com/pdfluent/pdfluent-sdk
8
+ Project-URL: Bug Tracker, https://github.com/pdfluent/pdfluent-sdk/issues
9
+ Author-email: "Innovation Trigger B.V." <team@pdfluent.com>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: markdown,markitdown,pdf,pdfluent,plugin,rag
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Topic :: Text Processing
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: markitdown>=0.1.0
24
+ Requires-Dist: pdfluent>=1.1.0
25
+ Description-Content-Type: text/markdown
26
+
27
+ # markitdown-pdfluent
28
+
29
+ A [MarkItDown](https://github.com/microsoft/markitdown) plugin that converts PDFs with the
30
+ [PDFluent](https://pdfluent.com) engine. It runs on your machine and needs no network.
31
+
32
+ ## Install
33
+
34
+ ```bash
35
+ pip install markitdown-pdfluent
36
+ ```
37
+
38
+ ## Use
39
+
40
+ Plugins are off by default in MarkItDown. Turn them on:
41
+
42
+ ```python
43
+ from markitdown import MarkItDown
44
+
45
+ md = MarkItDown(enable_plugins=True)
46
+ print(md.convert("report.pdf").markdown)
47
+ ```
48
+
49
+ From the command line:
50
+
51
+ ```bash
52
+ markitdown --use-plugins report.pdf
53
+ ```
54
+
55
+ The plugin registers ahead of MarkItDown's built-in PDF converter, so PDFs go through PDFluent and
56
+ every other format keeps using MarkItDown's own converters.
57
+
58
+ ## Licence
59
+
60
+ This plugin is MIT licensed; see `LICENSE`. The PDFluent engine it calls (`pdfluent` on PyPI) is
61
+ licensed separately, under AGPL-3.0 or a commercial licence.
@@ -0,0 +1,7 @@
1
+ markitdown_pdfluent/__init__.py,sha256=3PVMeJFEsu4wT9QEqp2zHj1IAkX3GYklbTOZ1VBAOpQ,744
2
+ markitdown_pdfluent/_converter.py,sha256=7BYYLV7YhpHQPf6ZGI2c8WL-zWNtPBo87n9nQF6NVg4,1550
3
+ markitdown_pdfluent-0.1.0.dist-info/METADATA,sha256=kAviOTbK9lJUEXW2cGalwbMSOJnQsSfQG8ZDP7hyfAM,2040
4
+ markitdown_pdfluent-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
5
+ markitdown_pdfluent-0.1.0.dist-info/entry_points.txt,sha256=mydN4cTXMBaotyyZ7MBzTbEfzHAHMnPOn5iI6Jv1Fm8,51
6
+ markitdown_pdfluent-0.1.0.dist-info/licenses/LICENSE,sha256=m4gt7rb42RFfVnUB64k_lgdYqOgIq-W3iNwWiNVvdOc,1080
7
+ markitdown_pdfluent-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [markitdown.plugin]
2
+ pdfluent = markitdown_pdfluent
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Innovation Trigger B.V.
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.