Metadata-Version: 2.4
Name: textual-pdf
Version: 0.1.5
Summary: Display PDF files in textual widgets!
Project-URL: Issues, https://github.com/NSPC911/textual-pdf/issues
Project-URL: Source, https://github.com/NSPC911/textual-pdf
Author: NSPC911
Keywords: pdf,python,textual,tui
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Utilities
Requires-Python: >=3.13
Requires-Dist: click>=8.2.1
Requires-Dist: pillow>=11.3.0
Requires-Dist: pymupdf>=1.21.64
Requires-Dist: textual-image>=0.8.3
Requires-Dist: textual>=5.3.0
Description-Content-Type: text/markdown

# Textual PDF

A Textual widget for viewing PDF files.

## Installation

Install the package using your package manager:

```sh
pip install textual-pdf
uv add textual-pdf
poetry add textual-pdf
```

## Usage

Here is a simple example of how to use the `PDFViewer` widget in your Textual application:

```python
from textual.app import App, ComposeResult
from textual_pdf.pdf_viewer import PDFViewer

class PDFApp(App):
    def compose(self) -> ComposeResult:
        yield PDFViewer("path/to/your/document.pdf")

app = PDFApp()
app.run()
```

The `PDFViewer` class also comes with an option to switch protocols

`PDFViewer` supports whatever image protocols `textual-image` supports, which are `TGP`, `Sixel`, and `Halfcell` and `Unicode`

`TGP` and `Sixel` are the most recommended to use as they allow the clearest image to be produced. `Halfcell` and `Unicode` are not readable at all, and simply exists for the fun of it.

```py
# use tgp
PDFViewer("path/to/your/document.pdf", protocol="TGP")
# autodetect (default)
PDFViewer("path/to/your/document.pdf", protocol="Auto")
```

## CLI

`textual-pdf` is available as a CLI tool via `ptf`
```
uv tool install git+https://github.com/NSPC911/ptf
```

## License

This project is licensed under the MIT License.
