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.0.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.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for textual_pdf-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b2793e81da649032a1250c326b412b9793166d8918a7cb69d671284a4fd4a166
MD5 c65bb1a652f3d42c414686b38e8a706c
BLAKE2b-256 5f32a394d78689f40f53a6c2b7509459cfc3db533d1a7ef9e3612d3ba71bd7df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for textual_pdf-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46f6cb14a4b69b0d8170cd63ada92c9a7301c8d97b3b9ec49f6dd47214a5ee45
MD5 2e158d9f7bd4334303573e894e6ba26d
BLAKE2b-256 cd12bdd67b529f48594f02b243d75fcb148bee15f881225db2d6b5efd601af27

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