Installation
This guide provides detailed instructions for installing NeoPDF
and its APIs for Rust, Python,
Fortran, and C/C++.
Rust Crate
To use neopdf
in your Rust project, simply add the following to your Cargo.toml
:
Cargo will automatically fetch and compile the dependency the next time you build your project with:
Python API
To build the Python API from the source code, make sure that maturin is
installed, go into the neopdf_pyapi
directory, and then simply run:
This will build and install the NeoPDF
Python extension in your current environment. Alternatively,
neopdf
is also available on the Python Package Index (PyPI) and therefore can be installed with
your favourite Python's package manager. For example, using pipx:
C/C++ API
To build the C-API from source, first install cargo-c
:
Then go into the neopdf_capi
directory and run the following command:
export CARGO_C_INSTALL_PREFIX=${prefix} # Needed if you want the OOP C++ header
cargo cinstall --release --prefix=${prefix}
This will install the library in the ${prefix}
path. This path can then be added to the PKG_CONFIG_PATH
and LD_LIBRARY_PATH
environment variables by running:
export LD_LIBRARY_PATH=${prefix}/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=${prefix}/lib/pkgconfig:$PKG_CONFIG_PATH
Remember to source your shell configuration or restart your terminal for the changes to take effect.
CLI Tool
To build and install the NeoPDF command-line interface (CLI) from source, simply run:
This will compile the CLI in debug mode and make the neopdf
command available in your
cargo bin directory (usually ~/.cargo/bin
). You can then run neopdf --help
to see
the available commands.
Note on where to store PDF sets
By default, NeoPDF
stores PDF sets in ${HOME}/.local/share/NeoPDF
, however this can be
overwritten via the environment variable NEOPDF_DATA_PATH
to point to the LHAPDF path for
example.