Giter Club home page Giter Club logo

pdf-viewer's Introduction

PDF-Viewer

Warning: This project is currently not being actively maintained. When I initially developed this project, I had only about a week available. PySimpleGUI was also in its early stages, and there may have been updates that could simplify certain sections of the code. I am working on finding some time to update the code to the latest Python and PySimpleGUI versions. However, please note that this project should still fulfill your requirements.


A Pure Python PDFViewer, which provides almost all the functionalities you want from a PDF reader. Following are the some of main features of this application
  • Searching through a PDF document
  • Table of contents
  • Take notes and save them automatically
  • Night mode for taking care of your eyes
  • Zooming feature
  • Developed in pure Python (python-3.7.4)

Why bother creating a new PDF Viewer?

I wanted to create an application that requires me to have a PDF Viewer with access to the source code, in Python. I searched the internet for a PDF Viewer written in Python, but all in vain. I couldn't find any good results. Hence, I decided to create my own PDF Viewer, that uses pure Python packages.

How to run?

Make sure you have installed these packages:

  • PySimpleGUI
  • PyMuPDF
  • fitz

You can simply run this command to install all packages. First make sure you are in the same directory as requirements.txt, then type:

pip install -r requirements.txt

This will install all the packages, then you have to simply run this command:

python pdfviewer.py

The given command will generate this screen: 1

Now, you can open any book and enjoy reading. 5xVcJDdb75

Searching

We all want to search through a document and get things done quickly, well I got your back. Keep searching using this advanced user-friendly search feature.

1

Night Mode

If you want to read more but your eyes can't see the white screen anymore, switch to night mode. This not only updates the application's theme but converts the PDF to black background and white text so that your eyes can relax. night

Notes

Well, you can take notes as you go through the book. On the right side, there is a space for writing anything you want. There is a "Check Box" at the right-hand corner make sure that box is checked, only then will the note be saved.

A file name like "%PDF Filename%_notes.txt" will appear once you close the document. This file will look something like this:

animated

You can see how easy it is to navigate through this text file and see all the notes.

What's so special about it?

Once you have taken the notes, then, whenever you open the same file again, all the notes will appear again concerning their page number. If you take the example of the above-given screenshot of the notes.txt, when I open the same file again you can see the notes:

animated

Make sure you don't delete the text file that is created automatically by the PDFViewer.

Buy me a coffee

If you like my effort and want this project to move forward, you can support this project by using the Sponsor button above. I appreciate your generous help.

Pythonic Code

This code is not as Pythonic as I want it to be, but I had just enough time and resources to get this done, so this is what it is. I might take 1-2 days out of my schedule to refactor this code base.

Special Thanks

I want to thank PySimpleGUI for developing such a great GUI-Framework in Python.

pdf-viewer's People

Contributors

nicolasmicaux avatar zain-bin-arshad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pdf-viewer's Issues

English Translation

I stumbled upon this while searching for a PDF viewer. I want to use it, but I don't understand Arabic. So, could you provide an English translation (Also, a possible bug-- when I clicked on the book icon, no prompt showed up for me to open a file)?

NOT WORKING

I install all the requirements but it is still not working.
RuntimeError: Directory 'static/' does not exist

Requirements problems

Hi,
I ran
git clone https://github.com/Zain-Bin-Arshad/pdf-viewer.git cd pdf-viewer/ pip install -r requirements.txt

i got errors :
Traceback (most recent call last): File "pdfviewer.py", line 40, in <module> import fitz File "/xxxxx/venv/lib/python3.8/site-packages/fitz/__init__.py", line 1, in <module> from frontend import * ModuleNotFoundError: No module named 'frontend'
related to https://stackoverflow.com/questions/56467667/how-do-i-resolve-no-module-named-frontend-error-message

you also forgot to mention the python version you're using. I think it's 2.7 ?

Using python 2.7 venv, pip install -r requirements.txt returns compilation errors on linux.

ERROR: Command errored out with exit status 1:
   command: /xxxxxxxxxx/venv/bin/python2.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1ddHG9/pymupdf/setup.py'"'"'; __file__='"'"'/tmp/pip-install-1ddHG9/pymupdf/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-CrAJvS
       cwd: /tmp/pip-install-1ddHG9/pymupdf/
  Complete output (20 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  creating build/lib.linux-x86_64-2.7/fitz
  copying fitz/__init__.py -> build/lib.linux-x86_64-2.7/fitz
  copying fitz/fitz.py -> build/lib.linux-x86_64-2.7/fitz
  copying fitz/utils.py -> build/lib.linux-x86_64-2.7/fitz
  copying fitz/__main__.py -> build/lib.linux-x86_64-2.7/fitz
  running build_ext
  building 'fitz._fitz' extension
  creating build/temp.linux-x86_64-2.7
  creating build/temp.linux-x86_64-2.7/fitz
  x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-U5f0ID/python2.7-2.7.18=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/mupdf -I/usr/local/include/mupdf -Imupdf/thirdparty/freetype/include -I/usr/include/python2.7 -c fitz/fitz_wrap.c -o build/temp.linux-x86_64-2.7/fitz/fitz_wrap.o
  fitz/fitz_wrap.c:2767:10: fatal error: fitz.h: Aucun fichier ou dossier de ce type
   2767 | #include <fitz.h>
        |          ^~~~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ERROR: Failed building wheel for PyMuPDF

I was very impressed by your PDF viewer screenshots, so I would love to use your code.

Thx a lot.
N. M.

Congratulations!

Hi!

It's been a bit since I last looked at your screenshots. I'm being 100% honest and I saw with no hesitation in saying that they're better than any PDF reader I've ever seen written in PySimpleGUI. There were a number of challenges and you stuck with it. That's an impressive feat on its own.

My hope is that as PySimpleGUI continues to mature that these areas that were difficult become easier to work with. Thank you for posting screenshots in your readme and for posting an entry on the PySimpleGUI Wiki. I'm sure everyone that sees them appreciates you taking them. So often it's not possible to understand / see what a Python program does because it lacks a GUI. By having one and sharing it, your users get to see the end result.

I don't know if you've approached any of the GitHub repos like Vinta that lists applications. I think it's worth you going through the process. It can take months to get the approval and be integrated into the list, but once you're there, you're there for life basically. It depends on the goals of your project and if you want to attract more users. If your goal was to create it and actively attracting users is not something you're interested in, then by all means don't waste your time.... enjoy that time doing something else!

Congrats again. I hope you feel proud about what you've created as I see plenty of reasons you could be.

Opens up fullscreen and has weird dimensions

Hi-

Just got to say what a great viewer...well done. I seem to be having the same issue that was brought up a year ago where you cant really see TOC and Notes...That was fixed?

Scott

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.