Skip to content

fw623/pdf-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDF Tools README

http://melpa.org/packages/pdf-tools-badge.svg

About this package

PDF Tools is, among other things, a replacement of DocView for PDF files. The key difference is, that pages are not prerendered by e.g. ghostscript and stored in the file-system, but rather created on-demand and stored in memory.

This rendering is performed by a special library named, for whatever reason, poppler, running inside a server programm. This programm is called epdfinfo and it’s job is it to successively read requests from Emacs and produce the proper results, i.e. the PNG image of a PDF page.

Actually, displaying PDF files is just one part of PDF Tools. Since poppler can provide us with all kinds of informations about a document and is also able to modify it, there is a lot more we can do with it. Watch

Features

View

View PDF documents in a buffer with DocView-like bindings.

Isearch

Interactively search PDF documents like any other buffer. (Though there is currently no regexp support.)

Follow links

Click on highlighted links, moving to some part of a different page, some external file, a website or any other URI. Links may also be followed by keyboard commands.

Annotations

Display and list text and markup annotations (like underline), edit their contents and attributes (e.g. color), move them around, delete them or create new ones and then save the modifications back to the PDF file.

Attachments

Save files attached to the PDF-file or list them in a dired buffer.

Outline

Use imenu or a special buffer to examine and navigate the PDF’s outline.

SyncTeX

Jump from a position on a page directly to the TeX source and vice-versa.

Misc

  • Display PDF’s metadata.
  • Mark a region and kill the text from the PDF.
  • Search for occurrences of a string.
  • Keep track of visited pages via a history.

Installation

The package may be installed via melpa and it will try to build the server part when it is actiated the first time, though next section is still relevant.

Server Prerequisites

You’ll need GNU Emacs ≥ 24.3 and some form of a GNU/Linux OS. Other operating systems are currently not supported (patches welcome). The following instructions assume a Debian-based system. (The prerequisites may be installed automatically on this kind of systems, see Compilation .)

First make shure a suitable build-system is installed. We need at least a C/C++ compiler (both gcc and g++), make, automake and autoconf.

Next we need to install a few libraries PDF Tools depends on, some of which are probably already on your system.

$ sudo aptitude install libpng-dev libz-dev 
$ sudo aptitude install libpoppler-glib-dev 
$ sudo aptitude install libpoppler-private-dev 

On some older Ubuntu systems, the final command will possibly give an error. This should be no problem, since in some versions this package was contained in the main package libpoppler-dev.

Debian wheezy comes with libpoppler version 0.18, which is pretty old. The minimally required version is 0.16, but some features of PDF Tools depend on a more recent version of this library. See the following table for what they are and what version they require.

You want to …Required version
… create and modify text annotations.≥ 0.19.4
… search case-sensitive.≥ 0.22
… create and modify markup annotations.≥ 0.26

In case you decide to install libpoppler from source, make shure to run it’s configure script with the --enable-xpdf-headers option.

Finally there is one feature (following links of a PDF document by plain keystrokes) which requires imagemagick’s convert utility. This requirement is optional and you may install it like so:

$ sudo aptitude install imagemagick

Compiling on OS X

Although OS X is not officially supported, it has been reported to have been successfully compiled. You will need to install poppler which you can get with homebrew via

$ brew install poppler

You will also have to help pkg-config find some X11 libraries by setting PKG_CONFIG_PATH:

$ export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig

After that, compilation should proceed as normal.

Compilation

Now it’s time to compile the source.

$ cd /path/to/pdf-tools
$ make install-server-deps # optional
$ make -s

The make install-server-deps command will try to install all nescessary programms and libraries to build the package, though it’ll only work, if sudo and apt-get are available.

This should compile the source code and create a Emacs Lisp Package in the root directory of the project. The configure script also tells you at the very end, which features, depending on the libpoppler version, will be available. These commands should give no error, otherwise you are in trouble.

Installing

If make produced the ELP file pdf-tools-${VERSION}.tar you are fine. This package contains all the nescessary files for Emacs and may be installed by either using

$ make install-package

or executing the Emacs command

M-x package-install-file RET pdf-tools-${VERSION}.tar RET

To complete the installation process, you need to activate the package by putting

(pdf-tools-install)

somewhere in your .emacs. Next you probably want to take a look at the various features of what you’ve just installed. The following two commands might be of help for doing so.

M-x pdf-tools-help RET
M-x pdf-tools-customize RET

Updating

Some day you might want to update this package via git pull and then reinstall it. Sometimes this may fail, especially if Lisp-Macros are involved and the version hasn’t changed. To avoid this kind of problems, you should delete the old package via list-packages, restart Emacs and then reinstall the package.

This also applies when updating via package and melpa.

About

Emacs support library for PDF files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 48.8%
  • Emacs Lisp 48.3%
  • Shell 1.4%
  • Makefile 0.6%
  • M4 0.3%
  • Dockerfile 0.3%
  • Other 0.3%