Git Product home page Git Product logo

pdfdog's Introduction

PDFdog

This is a small utility program that will bring up the default viewer for a pdf file, and then watch the file for any changes. When the file is modified it restarts the viewer to show the updated pdf.

pdfdog myfile.pdf

It will then "dog" that pdf.

Rationale

I routinely write applications in Django or wxPython that produce lots of complicated pdf layouts via ReportLab. The design and layout is an iterative process (ready, fire, aim!). So I needed a pdf viewer that would automatically show the updated pdf every time I run it.

I develop mostly on Windows and Adobe Reader is the defacto standard viewer - but it has an annoying habit of locking whatever file it's showing. So before you can do a run to produce a new pdf, you must remember to close Reader, and then immediately restart it once the new file is created. It really slows down the work flow. PDFdog works around this problem by first copying the pdf to a temp file and displaying that, then when the target pdf changes it copies that one and restarts.

It tries to remove the temp files when they are no longer needed.

Usage

Usage:
    pdfdog [-q|-l] <filename>
    pdfdog (-h | --help)
    pdfdog --version

Options:
    -h --help     Show this screen.
    -q            Quiet. Don't print informative messages. The default.
    -l            Log informative messages to stdout.
    --version     Show version.

It is intended to be run from the CLI. Just hit CTRL-C to exit the program.

Limitations

Works only on Windows for now. It tries really hard to find the default viewer from the Windows registry and use that; there shouldn't be problems if the viewer is properly installed. To date I've only tested it on Windws 7 and using Adobe Reader 11 ... but that will change.

Bugs

  • If, before PDFdog is run, there is an existing pdf open in Adobe Reader, then PDFdog will not be able to kill the appropriate pid and it will seem to do nothing when the pdf of interest changes.
  • If, after PDFdog is run, there is another Adobe Reader window opened, when PDFdog terminates its window, that other Reader screen will also terminate.

This would seem to indicate Adobe Reader shouldn't be used for much of anything else when PDFdog is running.

Downloads

There is a Windows binary available in Releases. It does not need to be installed, just put the executable somewhere in your path.

Otherwise, grab the code from github. The only dependency is docopt. I have only run it on Python 2.7 so far.

License

License: MIT license (see LICENSE.txt).

Future Enhancements

A few things that might be good to implement:

  • Fix the aforementioned bug(s) above.
  • Get it working on Linux and Mac. How badly is it needed on these platforms given that a big part of its reason for existing stems from the bad behavior of Adobe Reader on Windows?
  • Enable an option to give it a python module and method to call to produce the pdf.
  • Implement the excellent pdfviewer module from wxPython so this program could show the pdf without needing an outside viewer (if nothing else, this improves performance and reduces the amount of distracting screen activity).

pdfdog's People

Contributors

michaelhipp avatar

Stargazers

 avatar

Watchers

 avatar

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.