Skip to content

Commit

Permalink
docs: updated python binding readme
Browse files Browse the repository at this point in the history
  • Loading branch information
nmammeri committed Sep 11, 2024
1 parent b7ce214 commit e4edb41
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions bindings/extractous-python/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# extractous Python Bindings
# Extractous Python Bindings

This project provides Python bindings for the extractous library, allowing you to use extractous functionality in your Python applications.
This project provides Python bindings for the Extractous library, allowing you to use extractous functionality in
your Python applications.

## Installation

Expand All @@ -12,10 +13,31 @@ pip install extractous

## Usage

extract pdf example:
Extracting a file to string:

```python
from extractous import extract
from extractous import Extractor

extract("/tmp/test.pdf")
extractor = Extractor()
extractor.set_extract_string_max_length(1000)
result = extractor.extract_file_to_string("README.md")

print(result)
```

Extracting a file to a buffered stream:

```python
from extractous import Extractor

extractor = Extractor()
reader = extractor.extract_file("tests/quarkus.pdf")

result = ""
buffer = reader.read(4096)
while len(buffer) > 0:
result += buffer.decode("utf-8")
buffer = reader.read(4096)

print(result)
```

0 comments on commit e4edb41

Please sign in to comment.