Skip to main content

Display PDF files in textual widgets!

Project description

Textual PDF

A Textual widget for viewing PDF files.

Installation

Install the package using your package manager:

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:

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.

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

CLI

This package also provides a command-line interface to view PDF files directly from your terminal.

textual-pdf-view /path/to/your/document.pdf

Key Bindings

Key Action
Down, Right, j, l, PageDown Go to next page
Up, Left, k, h, PageUp Go to previous page
PageDown Go to next page
PageUp Go to previous page
Home Go to first page
End Go to last page

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

textual_pdf-0.1.3.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

textual_pdf-0.1.3-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file textual_pdf-0.1.3.tar.gz.

File metadata

  • Download URL: textual_pdf-0.1.3.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.14

File hashes

Hashes for textual_pdf-0.1.3.tar.gz
Algorithm Hash digest
SHA256 a6c9b099b830f151e721102f8d4f4a54bb5594224ea47a26974f3eefa44d362e
MD5 41e26f2af2934312236bfcd8515d896a
BLAKE2b-256 9a6664fea7f2fd8f34dd8e4da56934fd702c533bed5b8f7c1e7ffbe5093178b4

See more details on using hashes here.

File details

Details for the file textual_pdf-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for textual_pdf-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 281844f7831cf02234c85541ed30d05457279b42bd6e7352e22560edf251fbf1
MD5 b1df4448015c5e8cfd5df23f42900429
BLAKE2b-256 d4f7c7298806be85bba085ca9c423182c77598ed44b335ef000d3a2fb7ea2ee7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page