Giter Club home page Giter Club logo

pdfhelper's Introduction

Readme

中文文档

About

This is a script that deal with pdf file. At present, the following functions are supported:

  1. exports the outline/toc of a PDF to a human-readable file. You can see the format here
  2. imports the toc into a PDF
  3. extracts annotations (highlights, comments, etc.) from a PDF file, and formats them as org-mode.

Dependency

  • Python 3
  • PyMuPDF
    pip3 install pymupdf
        

Usage

See pdfannots.py --help for options and invocation.

python3 pdfhelper.py -h

TOC format

Sample toc file:

Here, you see three ways of customization:

  1. define page number: create a bookmark called 「The Five Rules」 at page 3
  2. set first page: create a bookmark called 「1. Toys」 at page 17 (since the first page is 16)
    • In fact, you can use any text match “# xxx = number” to set first page to number
  3. set page gap: create a bookmark called 「4. Numbers Games」 at page 58+(16-1)-2=71 (You have to minus 2 pages gap to get correct page number)
    • useful when there are missing pages

Export Annotations

Currently, the following annotation types are supported:

TypeResult
Texttext
Squarepicture, you can set the zoom factor by --image-zoom and ocr the picture by --ocr-api
Highlightcomment + text
Underlinecomment + text
Squigglycomment + text
StrikeOutcomment + text

You can customize the note format by

  • --with-toc
  • --toc-list-item-format
  • --annot-list-item-format

Changelog

  • 1.3.0
    • improve feature import-toc: Support set the first page and fix a gap. See more info here
  • 1.2.0
    • new feature export-annot: Export the annotations of pdf
  • 1.1.0
    • new feature export-toc: Export the toc of pdf to human-readable file. You can see the format here
    • new feature import-toc: Import the toc of pdf, the toc shares the same format with the exported one

Credits

This project is inspired by the following tool:

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.