GithubHelp home page GithubHelp logo

pdfbookmarker's Introduction

PDFBookmarker

Add bookmarks into PDF using PyPDF2.

Installation

Install pdfbookmarker:

$ pip install pdfbookmarker

Usage

  1. Turn to your target PDF (e.g. MyBook.pdf), record bookmark titles and page numbers of the PDF into a TEXT file (e.g. my_bookmarks.txt) by hand with the following format:

    <nested level>"<bookmark title>"|<page number>
    

    For samples, see sample_bookmarks.txt. (Offsets are also supported, see here)

  2. Generate a copy of MyBook.pdf with additional bookmarks file specified by my_bookmarks.txt:

    $ pdfbm MyBook.pdf my_bookmarks.txt

    An auto-detected, expected or suggested filename for bookmarks is MyBook.txt, when the input filenamne e.g. is MyBook.pdf.

    The default filename of the output PDF is MyBook-new.pdf; You, of course, can specify the filename explicitly:

    $ pdfbm MyBook.pdf my_bookmarks.txt MyBook_with_bookmarks.pdf

License

MIT

pdfbookmarker's People

Contributors

bdheeman avatar pvc1989 avatar russellluo avatar suokunlong 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  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pdfbookmarker's Issues

what if titles has " ... " inside?

hello. i was looking for a simple book mark adding tool for longer now. i found one once but it only recognized sub-bookmarkes when you added cahpters which are also displayed in the bookmarks. ( like 1 and 1.1 and 1.1.1 etc).
but this one seem to simply work with adding sub-bookmarks with +, ++, +++ etc. without needing to add numbers. that's exactly what i needed.

i didnt test it yet, but i will soon. i thought i would just ask here until i can test it myself: what if i have a title like:
The "house" has a pretty color
then i would have to write like:
+"The "house" has a pretty color"|5
will this be properly recognized, or does it conflict?

Error with a lot of pages :(

When I launch the script with bookmarks for 700 pages i've this error:

maximum recursion depth exceeded while calling a Python object

Thanks for help

Offsets is not working

adding '//+13' just does nothing, the first bookmark still points to first page, no offset

//+13
+"第1章 熟悉LATEX"|1
++"1.1让LATEX跑起来"|2
+++"1.1.1 LATEX的发行版及其安装"|2
++++"CTEX套装"|3
++++"TEX Live"|7
+++"1.1.2 编辑器与周边工具"|13
++++"编辑器举例—TeXworks"|13
++++"PDF阅读器"|18
++++"命令行工具"|21

pdfbookmarker erases all other metadata :-(

The pdfbookmarker erases all other metadata :-(

I'm not expert enough or seasoned python programmer, but I think, it's better use PdfFileMerger(), readin metaInfo using getDocumentInfo(), XmpInformation() and do preserve or merge this into output file.

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.