| 1 |
Xpdf |
| 2 |
==== |
| 3 |
|
| 4 |
version 4.06 |
| 5 |
2025-nov-14 |
| 6 |
|
| 7 |
The Xpdf software and documentation are |
| 8 |
copyright 1996-2025 Glyph & Cog, LLC. |
| 9 |
|
| 10 |
Email: [email protected] |
| 11 |
WWW: http://www.xpdfreader.com/ |
| 12 |
|
| 13 |
|
| 14 |
Compiling xpdf |
| 15 |
-------------- |
| 16 |
|
| 17 |
Xpdf is written in C++ (with a little bit of C). It should work with |
| 18 |
any ANSI-compliant C++ and C compilers. The systems and compilers |
| 19 |
it's been tested with are listed on the xpdf web page. |
| 20 |
|
| 21 |
Xpdf requires the Qt toolkit. The non-GUI command line tools do not |
| 22 |
use Qt. |
| 23 |
|
| 24 |
The following notes give specific instructions for compiling on |
| 25 |
different systems. |
| 26 |
|
| 27 |
|
| 28 |
********************* |
| 29 |
*** Linux, OS X *** |
| 30 |
********************* |
| 31 |
|
| 32 |
* Make sure you have the following installed: |
| 33 |
|
| 34 |
- CMake 2.8.8 or newer |
| 35 |
- FreeType 2.0.5 or newer |
| 36 |
- Qt 5.x or 6.x (for xpdf only) |
| 37 |
- libpng (for pdftopng and pdftohtml) |
| 38 |
- zlib (for pdftopng and pdftohtml) |
| 39 |
|
| 40 |
If Qt isn't found, the GUI viewer (xpdf) won't be built, but the |
| 41 |
command line tools will still be built. |
| 42 |
|
| 43 |
* Create a build directory. These instructions assume that you create |
| 44 |
a directory called "build" under the top-level xpdf source |
| 45 |
directory, but the build directory can be anywhere you like. Create |
| 46 |
the directory and cd into it: |
| 47 |
|
| 48 |
cd ..../xpdf-X.YY |
| 49 |
mkdir build |
| 50 |
cd build |
| 51 |
|
| 52 |
* Run cmake: |
| 53 |
|
| 54 |
cmake -DCMAKE_BUILD_TYPE=Release {other options - see below} .. |
| 55 |
|
| 56 |
If your build directory isn't under the source, use the full path to |
| 57 |
the source directory: |
| 58 |
|
| 59 |
cmake -DCMAKE_BUILD_TYPE=Release {other options} ..../xpdf-X.YY |
| 60 |
|
| 61 |
* If cmake doesn't find FreeType, you can set FREETYPE_DIR to point to |
| 62 |
the FreeType install directory. Add this to the cmake command line: |
| 63 |
|
| 64 |
-DFREETYPE_DIR=/opt/freetype |
| 65 |
|
| 66 |
Cmake will look for ${FREETYPE_DIR}/include. |
| 67 |
|
| 68 |
You can also set the FreeType library location with: |
| 69 |
|
| 70 |
-DFREETYPE_LIBRARY=/opt/freetype/lib/libfreetype.so |
| 71 |
|
| 72 |
* If cmake doesn't find Qt, make sure qmake is on your executable |
| 73 |
search path. |
| 74 |
|
| 75 |
* To change the xpdf install directory, use: |
| 76 |
|
| 77 |
-DCMAKE_INSTALL_PREFIX=/opt/xpdf |
| 78 |
|
| 79 |
If you're familiar with autoconf, this is similar to the "--prefix" |
| 80 |
option. |
| 81 |
|
| 82 |
* Other configuration options are: |
| 83 |
|
| 84 |
-DSPLASH_CMYK=ON |
| 85 |
Enable CMYK rasterization support. |
| 86 |
|
| 87 |
-DA4_PAPER=ON |
| 88 |
Switches the default paper size for PostScript output (xpdf |
| 89 |
and pdftops) to A4. The default is Letter size. |
| 90 |
|
| 91 |
-DNO_TEXT_SELECT=ON |
| 92 |
With this option, xpdf will not copy text. (This is only |
| 93 |
useful on closed systems where the user can't get at the PDF |
| 94 |
file directly.) |
| 95 |
|
| 96 |
-DOPI_SUPPORT=ON |
| 97 |
Enables support for generation of OPI (Open Prepress |
| 98 |
Interface) comments with pdftops. |
| 99 |
|
| 100 |
-DNO_FONTCONFIG=ON |
| 101 |
Disables use of libfontconfig, which is used to locate system |
| 102 |
fonts on Linux/Unix systems. The default is to search for the |
| 103 |
library, and to use it if found. |
| 104 |
|
| 105 |
-DMULTITHREADED=0 |
| 106 |
Disables multithreading, which also disables building the GUI |
| 107 |
viewer (xpdf). This does not affect the command line tools. |
| 108 |
Disabling multithreading should only be necessary if you're |
| 109 |
building with a compiler other than gcc, clang, or Microsoft |
| 110 |
Visual Studio. |
| 111 |
|
| 112 |
-DXPDFWIDGET_PRINTING=OFF |
| 113 |
Disable printing support. |
| 114 |
|
| 115 |
-DUSE_XDG=ON |
| 116 |
Enables use of the XDG directories for config and state files. |
| 117 |
This defaults to ON for Linux, and OFF for everything else. |
| 118 |
|
| 119 |
-DSYSTEM_XPDFRC="/etc/xpdfrc" |
| 120 |
Look for a system-wide xpdfrc config file in this directory. |
| 121 |
|
| 122 |
-DXPDFRC_DATADIR="/usr/share/xpdf" |
| 123 |
The ${DATADIR} variable in xpdfrc config files will expand to |
| 124 |
this string. |
| 125 |
|
| 126 |
-DBASE14_FONT_DIR="/usr/share/fonts/type1" |
| 127 |
By default, Xpdf will look for the URW Type 1 fonts in several |
| 128 |
quasi-standard directories on Linux/Mac systems. This option |
| 129 |
adds another directory to that search path. On Windows, this |
| 130 |
does the same thing, except for the system TrueType fonts. |
| 131 |
|
| 132 |
-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets=1 |
| 133 |
-DCMAKE_DISABLE_FIND_PACKAGE_Qt6Widgets=1 |
| 134 |
Do not search for the Qt5/Qt6 libraries. This will disable |
| 135 |
building the GUI viewer (xpdf). Cmake will look for a "qmake" |
| 136 |
binary -- make sure the first qmake binary on your executable |
| 137 |
search path matches the desired version of Qt. |
| 138 |
|
| 139 |
-DCMAKE_C_FLAGS="..." |
| 140 |
-DCMAKE_CXX_FLAGS="..." |
| 141 |
Set additional options to pass to the C and/or C++ compilers. |
| 142 |
|
| 143 |
-DCMAKE_EXE_LINKER_FLAGS="..." |
| 144 |
Set additional options to pass to the linker. |
| 145 |
|
| 146 |
-DCMAKE_INSTALL_BINDIR |
| 147 |
Set the bin directory, relative to CMAKE_INSTALL_PREFIX |
| 148 |
(typically "bin"). |
| 149 |
|
| 150 |
-DCMAKE_INSTALL_MANDIR |
| 151 |
Set the man directory, relative to CMAKE_INSTALL_PREFIX |
| 152 |
(typically "man" or "share/man"). |
| 153 |
|
| 154 |
-DCMAKE_CXX_FLAGS="... -DDISABLE_SESSION_MANAGEMENT" |
| 155 |
Disable the session manager interface, i.e., do not |
| 156 |
automatically save and restore sessions under control of the |
| 157 |
session manager. |
| 158 |
|
| 159 |
* Build: |
| 160 |
|
| 161 |
make |
| 162 |
|
| 163 |
This will build the executables in the build directory: |
| 164 |
|
| 165 |
xpdf/xpdf |
| 166 |
xpdf/pdftops |
| 167 |
xpdf/pdftotext |
| 168 |
xpdf/pdftohtml |
| 169 |
xpdf/pdfinfo |
| 170 |
xpdf/pdffonts |
| 171 |
xpdf/pdfdetach |
| 172 |
xpdf/pdftoppm |
| 173 |
xpdf/pdftopng |
| 174 |
xpdf/pdfimages |
| 175 |
xpdf-qt/xpdf |
| 176 |
|
| 177 |
* If desired, install the binaries and man pages: |
| 178 |
|
| 179 |
make install |
| 180 |
|
| 181 |
If you want to run a quick test, there is a tiny PDF file included |
| 182 |
with xpdf, as misc/hello.pdf . |
| 183 |
|
| 184 |
|
| 185 |
***************** |
| 186 |
*** Windows *** |
| 187 |
***************** |
| 188 |
|
| 189 |
The Windows build procedure is essentially the same as for Unix. If |
| 190 |
building with cygwin, the procedure is identical to Unix. |
| 191 |
|
| 192 |
If building with Visual Studio: |
| 193 |
|
| 194 |
* Make sure you have CMake, FreeType, libpng, and zlib installed. |
| 195 |
|
| 196 |
* You'll need to set the FREETYPE_DIR variable to point to your |
| 197 |
FreeType installation, CMAKE_INCLUDE_PATH to point to your libpng |
| 198 |
includes, CMAKE_LIBRARY_PATH to point to your libpng library, and |
| 199 |
ZLIB_ROOT to point to your zlib installation. |
| 200 |
|
| 201 |
cmake -G "NMake Makefiles" |
| 202 |
-DCMAKE_BUILD_TYPE=Release |
| 203 |
-DFREETYPE_DIR="c:/software/freetype" |
| 204 |
-DCMAKE_INCLUDE_PATH="c:/software/libpng" |
| 205 |
-DCMAKE_LIBRARY_PATH="c:/software/libpng" |
| 206 |
-DZLIB_ROOT="c:/software/zlib" |
| 207 |
.. |
| 208 |
|
| 209 |
* Build: |
| 210 |
|
| 211 |
nmake |