Comprehensive TeX Archive Network

Direc­tory macros/latex/contrib/pax

README for project pax (PDFAnnotExtractor), 2012/04/23 v0.1l


A. Project pax
B. Copyright, License
C. Files
D. Author
E. Requirements
F. Download
G. Installation
H. Use
I. History


If PDF files are included using pdfTeX, PDF annotations
are stripped. This project tries a solution without
altering pdfTeX. A Java program (pax.jar) parses the PDF file that
will later be included. It writes the data of the annotations
in a file that can be read by TeX. Then a LaTeX package (pax.sty)
extends the graphics package. If a PDF file is included, the package
looks for the file with the annotation data, reads them and puts
the annotations in the right place.

Project status: experimental


Copyright (C) 2006-2008, 2011, 2012 Heiko Oberdiek.

The project consists of two parts:
* The Java program pax.jar with sources.
  The Perl wrapper pdfannotextractor.pl.
  License is GPL, see license/gpl.txt.
* The LaTeX package pax.sty.
  License is LPPL 1.3.
The file README belongs to both parts.

The Java program uses the PDF library PDFBox,
see http://pdfbox.apache.org/.


The project is available in CTAN (ftp.ctan.org):

There are the following files:
    This file.
* pax.tds.zip
    The whole project, ready to unpack in a TDS (texmf) tree.

The files inside pax.tds.zip:
* doc/latex/pax/README
    This file.
* scripts/pax/pax.jar
    The Java program.
* scripts/pax/pdfannotextractor.pl
    Perl wrapper for calling the Java program in pax.jar.
* source/latex/pax/license/LaTeX/lppl.txt
    License (LPPL) for the LaTeX package.
* source/latex/pax/license/PDFAnnotExtractor/gpl.txt
    License (GPL) for the Java program.
* source/latex/pax/src/Constants.java
    Java source files.
* source/latex/pax/src/MANIFEST.MF
    Manifest file for the JAR file.
* source/latex/pax/src/build.xml
    Ant build file for generating the JAR file.
* tex/latex/pax/pax.sty
    The LaTeX package.


Heiko Oberdiek <heiko.oberdiek at googlemail.com>


* Java 1.4+.
* PDFBox 0.7.2 or 0.7.3.
  However, PDFAnnotExtractor does not work with the recent
  versions of PDFBox, currently only the older versions
  0.7.2 or 0.7.3 are supported. The older versions are
  available at SourceForge:
* The Perl wrapper (optional) needs:
  * Perl
  * kpsewhich
  * java in PATH
  The option --install also requires:
  * wget or curl
  * unzip
  * texhash or mktexlsr


1. Download pax.tds.zip from CTAN:

2. Download PDFBox-0.7.3.jar from http://www.pdfbox.org/ (22 MB)
   Or install PDFBox as RPM package or whatever.


Examples are given for linux.

3. Install PDFBox (from its home page, RPM package, ...).
   The wrapper pdfannotextractor.pl looks for the JAR file in directories:
      TDS:scripts/pax/lib/ (TDS:scripts//)
   assuming one of the following names:

Alternative for 2. and 3.
   * Continue with 4. and 5.a).
   * Call `pdfannotextractor --install' (or with option --debug).
     It downloads PDFBox from its homepage and installs it
     in TEXMFVAR(VARTEXMF) below TDS:scripts/pax/

4. Unzip pax-tds.zip inside the TDS tree, where you want to put this
   project, e.g.:
     unzip pax-tds -d /usr/local/share/texmf
   Don't forget to update the database (texhash, mktexlsr, ...).

5.a) Install the wrapper Perl script pdfannotextractor.pl
     as `pdfannotextractor' somewhere in your PATH (/usr/local/bin,
     /usr/bin, ...).
5.b) Or write a wrapper script or whatever to ease the call of the
     Java program, e.g.:
       java -cp pax.jar:pdfbox.jar pax.PDFAnnotExtractor "$@"

Version of PDFBox
Developing the pax project I have used and tested version 0.7.2,
also the current version 0.7.3 seems to be fine. Older versions
are not supported at all, they may work or do not.


As example I am using usrguide.pdf (with links from project latex-tds)
that will be included in test.tex:

%%% cut %%% test.tex %%% cut %%%

% pdfpages loads graphicx


    filebordercolor={1 1 0},

%%% cut %%% test.tex %%% cut %%%

First run the Java program on usrguide.pdf:

  $ java -jar pax.jar usrguide.pdf

It generates usrguide.pax.
Next run pdflatex on test.tex twice at least:

  $ pdflatex test
  $ pdflatex test

Then the links should work.

Additionally package hyperref can be used (replace \iffase by \iftrue).
Then the links can be configured using hyperref settings.
(But keep in mind, the colored links by option colorlinks can't
be changed in included documents.

I. History

2006/08/24 v0.1a
  * First release.
2006/09/04 v0.1b
  * Bug fix in PDFAnnotExtractor.add_dest()/named destinations.
2007/06/29 v0.1c
  * \l@addto@macro renamed to \PAX@l@addto@macro to avoid
    collision with classes of KOMA-Script.
2007/06/30 v0.1d
  * Use of package `etexmcds'.
2007/07/12 v0.1e
  * The Java program can be called with several files.
2007/07/16 v0.1f
  * PDF files are explicitely closed to avoid warnings.
2007/07/18 v0.1g
  * Compiled for Java 1.4.
2007/07/19 v0.1h
  * JAR file without TDS tree.
2008/10/01 v0.1i
  * Perl wrapper `pdfannotextractor.pl' added.
  * Section `Installation' from README rewritten.
  * Class-Path removed from MANIFEST.MF.
2011/04/22 v0.1j
  * Update of email address and updating version dates
    for all files.
2011/07/06 v0.1k
  * Package `pax' uses package `kvsetkeys' to avoid
    problems with incompatible `xkeyval'.
2012/04/18 v0.1l
  * Option --version added to pdfannotextractor.pl.

pax – Ex­tract and rein­sert PDF an­no­ta­tions with pdf

If PDF files are in­cluded us­ing pdf, PDF an­no­ta­tions are stripped. The pax project of­fers a so­lu­tion with­out al­ter­ing pdf. A Java pro­gram (pax.jar) parses the PDF file that will later be in­cluded. The pro­gram then writes the data of the an­no­ta­tions into a file that can be read by .

The pack­age pax ex­tends the graph­ics pack­age to sup­port the scheme: if a PDF file is in­cluded, the pack­age looks for the file with the an­no­ta­tion data, reads them and puts the an­no­ta­tions in the right place.

Project sta­tus: ex­per­i­men­tal

Li­censeFree li­cense not oth­er­wise listed, or more than one free li­cense ap­plies
Copy­right2006–2008 Heiko Oberdiek
Main­tainerHeiko Oberdiek
TDS archivepax.tds.zip
Con­tained inTeX Live as pax
MiKTeX as pax
Topics ac­cess PDF fea­tures
See also pdftex
Guest Book Sitemap Contact Contact Author