Skip to main content

A PDF viewer for nicegui based on pdf.js

Project description

nicegui-pdf

A NiceGUI PDF component (using pdf.js) to nicely integrate PDFs without the need for iframes without having any control on which page is shown or without the possibility to read the seelcted text. A quick example is shown below:

    from nicegui import ui, app
    from nicegui_pdf.pdf_viewer import PdfViewer

    [...] 

    state = {
        "current_page": 1,
    }

    [...]

    ui.number().bind_value(state, "current_page")

    path = app.add_static_file(local_file="example/paper.pdf")
    PdfViewer(path).classes("w-full").style(
        "border: solid 1px gray;"
    ).bind_current_page(
        state
    )

Features

  • Full integration of PDF files into NiceGUI
  • Two-way binding of current_page
  • One-way binidng of num_pages, is_rendering and selected_text

A full example demonstrating all features is given in example/main.py:

table

ToDo's

  • Basic viewer
  • Text Overlay
  • Binding of pages etc
  • Binding of selected text
  • Support resizing
  • Binding on path (load new pdf document)
  • Highlight text (not 100% sure yet)
  • Push to pypi

Disclaimer

I'm neither a JS, NiceGUI or VUE expert. I simply tested a few things and found that an older version of PDF.js can be integrated as a custom NiceGUI component. Therefore, I cannot give any warranty etc. but still I'm trying to maintain this code. If you find any bugs or have feature requests, please open an issue or a pull request.

References

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

nicegui_pdf-0.0.1.tar.gz (408.2 kB view details)

Uploaded Source

Built Distribution

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

nicegui_pdf-0.0.1-py3-none-any.whl (410.7 kB view details)

Uploaded Python 3

File details

Details for the file nicegui_pdf-0.0.1.tar.gz.

File metadata

  • Download URL: nicegui_pdf-0.0.1.tar.gz
  • Upload date:
  • Size: 408.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for nicegui_pdf-0.0.1.tar.gz
Algorithm Hash digest
SHA256 5f2fe0b36a4ebb4d714c1c1bf4670053aba4cf4dd663458ae18773f02724bd1a
MD5 bf3fbeb3e8fca6f16afb176e4d86aac8
BLAKE2b-256 378ab548088453d0f63aa5344c9ee719790f717c36e935e19d7c1b3dd6f4a285

See more details on using hashes here.

File details

Details for the file nicegui_pdf-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: nicegui_pdf-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 410.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for nicegui_pdf-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 74eb2fd7ab0e10fa660aa78c2982fff6616b473960204c90015a2feb1cc06787
MD5 5a5b540931f48b659e167aa6c82a8e5c
BLAKE2b-256 7223ba7ac56f2b33a325a5e629c2353e8a8d58dd02672e1a7a1a3e256f583883

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