Using the Library
Working with XpdfSpliceThe XpdfSplice library uses opaque handles to represent input PDF files (type
XpdfSpliceInputHandle) and output PDF files (type
XpdfSpliceOutputHandle). Multiple input files and multiple output files can be open simultaneously, each with its own handle.
Any program that uses the library must include the XpdfSplice header file:
Using XpdfSplice in a multithreaded applicationIn a multithreaded application, the
xpdfSpliceInitfunction must be called before any other functions are called. Unlike in single-thread applications where this is optional, the
xpdfSpliceInitcall is required in multithreaded applications. Each PDF handle (
XpdfSpliceOutputHandle) must be used by only one thread. Given that constraint, all XpdfSplice functions (other than
xpdfSpliceInit) are thread-safe.
Compiling & linking on WindowsThe XpdfSplice library is supplied as a DLL (
XpdfSplice.dll) and an import library (
The following instructions are for Microsoft Visual C++ 6. Similar steps should work for other development environments.
- Add the include file directory: in the "Project Settings" dialog,
under the "C/C++" tab, in the "Preprocessor" category, add the library
include file directory (
- Add the import library: in the "Project Settings" dialog, under
the "Link" tab, in the "General" category, add the library
- Either add the library directory
....\XpdfSplice\lib) to your executable search path, or copy
XpdfSplice.dllinto the same directory as your application's executable.
Compiling & linking on LinuxThe XpdfSplice library is supplied as a shared library (
When compiling C or C++ code that uses the XpdfSplice library, you'll
need to supply a "
-I" flag pointing to the directory
containing the XpdfSplice includes. When linking, you'll need to supply
-L" flag pointing to the directory containing the
XpdfSplice library, and a "
-lXpdfSplice" flag to link with
Before running the application, make sure that the XpdfSplice
library directory is on the library search path. This this can be
done either by setting the
variable or by editing the system-wide
Compiling & linking on Mac OS XUsing XpdfSplice on OS X is very similar to using it on Linux. The shared library has a different extension (
libXpdfSplice.dylib), and you'll need to set the
Static libraryXpdfSplice includes a static library as well as the dynamic library. To use it, include
XpdfSpliceStatic.hin place of
XpdfSplice.h, and link to
libXpdfSplice.a(Linux, Mac OS X).
Example codeThe XpdfSplice library distribution includes a sample program,
pdfmerge.c, located in the
examplesdirectory. This programs demonstrate the use of the various XpdfSplice functions.
To build on Linux, edit the included Makefile and set the
variables according to the instructions inside the Makefile. Then run
To build on Windows, create a Visual C++ project, as described above.