Xpdf
====

version 4.03
2021-jan-28

The Xpdf software and documentation are
copyright 1996-2021 Glyph & Cog, LLC.

Email: xpdf@xpdfreader.com
WWW: http://www.xpdfreader.com/


Compiling xpdf
--------------

Xpdf is written in C++ (with a little bit of C).  It should work with
any ANSI-compliant C++ and C compilers.  The systems and compilers
it's been tested with are listed on the xpdf web page.

Xpdf requires the Qt toolkit.  The non-GUI command line tools do not
use Qt.

The following notes give specific instructions for compiling on
different systems.


*********************
***  Linux, OS X  ***
*********************

* Make sure you have the following installed:

    - CMake 2.8.8 or newer
    - FreeType 2.0.5 or newer
    - Qt 4.8.x or 5.x (for xpdf only)
    - libpng (for pdftoppm and pdftohtml)
    - zlib (for pdftoppm and pdftohtml)

  If Qt isn't found, the GUI viewer (xpdf) won't be built, but the
  command line tools will still be built.

* Create a build directory.  These instructions assume that you create
  a directory called "build" under the top-level xpdf source
  directory, but the build directory can be anywhere you like.  Create
  the directory and cd into it:

      cd ..../xpdf-X.YY
      mkdir build
      cd build

* Run cmake:

      cmake -DCMAKE_BUILD_TYPE=Release {other options - see below} ..

  If your build directory isn't under the source, use the full path to
  the source directory:

      cmake -DCMAKE_BUILD_TYPE=Release {other options} ..../xpdf-X.YY

* If cmake doesn't find FreeType, you can set FREETYPE_DIR to point to
  the FreeType install directory.  Add this to the cmake command line:

      -DFREETYPE_DIR=/opt/freetype

  Cmake will look for ${FREETYPE_DIR}/include.

  You can also set the FreeType library location with:

      -DFREETYPE_LIBRARY=/opt/freetype/lib/libfreetype.so

* If cmake doesn't find Qt, make sure qmake is on your executable
  search path.

* To change the xpdf install directory, use:

      -DCMAKE_INSTALL_PREFIX=/opt/xpdf

  If you're familiar with autoconf, this is similar to the "--prefix"
  option.

* Other configuration options are:

    -DSPLASH_CMYK=ON
        Enable CMYK rasterization support.

    -DA4_PAPER=ON
        Switches the default paper size for PostScript output (xpdf
        and pdftops) to A4.  The default is Letter size.

    -DNO_TEXT_SELECT=ON
        With this option, xpdf will not copy text.  (This is only
        useful on closed systems where the user can't get at the PDF
        file directly.)

    -DOPI_SUPPORT=ON
        Enables support for generation of OPI (Open Prepress
        Interface) comments with pdftops.

    -DNO_FONTCONFIG=ON
        Disables use of libfontconfig, which is used to locate system
        fonts on Linux/Unix systems.  The default is to search for the
        library, and to use it if found.

    -DMULTITHREADED=0
        Disables multithreading, which also disables building the GUI
        viewer (xpdf).  This does not affect the command line tools.
        Disabling multithreading should only be necessary if you're
        building with a compiler other than gcc, clang, or Microsoft
        Visual Studio.

    -DXPDFWIDGET_PRINTING=OFF
        Disable printing support.

    -DSYSTEM_XPDFRC="/etc/xpdfrc"
        Look for a system-wide xpdfrc config file in this directory.

    -DXPDFRC_DATADIR="/usr/share/xpdf"
        The ${DATADIR} variable in xpdfrc config files will expand to
        this string.

    -DCMAKE_DISABLE_FIND_PACKAGE_Qt4=1
    -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets=1
        Do not search for the Qt4/Qt5 libraries.  This will disable
        building the GUI viewer (xpdf).  Cmake will look for a "qmake"
        binary -- make sure the first qmake binary on your executable
        search path matches the desired version of Qt.

    -DCMAKE_C_FLAGS="..."
    -DCMAKE_CXX_FLAGS="..."
        Set additional options to pass to the C and/or C++ compilers.

    -DCMAKE_EXE_LINKER_FLAGS="..."
        Set additional options to pass to the linker.

    -DCMAKE_INSTALL_BINDIR
        Set the bin directory, relative to CMAKE_INSTALL_PREFIX
        (typically "bin").

    -DCMAKE_INSTALL_MANDIR
        Set the man directory, relative to CMAKE_INSTALL_PREFIX
        (typically "man" or "share/man").

* Build:

      make

  This will build the executables in the build directory:

      xpdf/xpdf
      xpdf/pdftops
      xpdf/pdftotext
      xpdf/pdftohtml
      xpdf/pdfinfo
      xpdf/pdffonts
      xpdf/pdfdetach
      xpdf/pdftoppm
      xpdf/pdftopng
      xpdf/pdfimages
      xpdf-qt/xpdf

* If desired, install the binaries and man pages:

      make install

If you want to run a quick test, there is a tiny PDF file included
with xpdf, as misc/hello.pdf .


*****************
***  Windows  ***
*****************

The Windows build procedure is essentially the same as for Unix.  If
building with cygwin, the procedure is identical to Unix.

If building with Visual Studio:

* Make sure you have CMake, FreeType, libpng, and zlib installed.

* You'll need to set the FREETYPE_DIR variable to point to your
  FreeType installation, CMAKE_INCLUDE_PATH to point to your libpng
  includes, CMAKE_LIBRARY_PATH to point to your libpng library, and
  ZLIB_ROOT to point to your zlib installation.

      cmake -G "NMake Makefiles"
            -DCMAKE_BUILD_TYPE=Release
            -DFREETYPE_DIR="c:/software/freetype"
            -DCMAKE_INCLUDE_PATH="c:/software/libpng"
            -DCMAKE_LIBRARY_PATH="c:/software/libpng"
            -DZLIB_ROOT="c:/software/zlib"
            ..

* Build:

      nmake
