diff --git a/cpdfmanual.pdf b/cpdfmanual.pdf index 7e1043f..4eb7fb1 100644 Binary files a/cpdfmanual.pdf and b/cpdfmanual.pdf differ diff --git a/cpdfmanual.tex b/cpdfmanual.tex index 496ef06..40e273d 100644 --- a/cpdfmanual.tex +++ b/cpdfmanual.tex @@ -338,7 +338,7 @@ int main (int argc, char ** argv) \end{small} \end{cpdflib} -\begin{cpdflib} +\begin{pycpdflib} \chapter*{Example Program in Python} This program loads a file \texttt{hello.pdf} from disk and writes out a @@ -346,10 +346,33 @@ document with the original included three times. \begin{small} \begin{verbatim} -(PYTHON EXAMPLE HERE) +#Merge example +import pycpdflib + +#DLL loading depends on your own platform. These are the author's settings. +if sys.platform.startswith('darwin'): + pycpdflib.loadDLL("/Users/john/repos/python-libcpdf/libpycpdf.so") +elif sys.platform.startswith('linux'): + pycpdflib.loadDLL("../libpycpdf.so") +elif sys.platform.startswith('win32') or sys.platform.startswith('cygwin'): + os.add_dll_directory("C:\\\\OCaml64/home/JohnWhitington/python-libcpdf/") + pycpdflib.loadDLL("libpycpdf.dll") + +#We will take the input hello.pdf and repeat it three times +mergepdf = pycpdf.fromFile('hello.pdf', '') + +#The list of PDFs to merge +pdfs = [mergepdf, mergepdf, mergepdf] + +#Merge them +merged = pycpdflib.mergeSimple(pdfs) + +#Write output +pycpdflib.toFile(merged, 'merged.pdf', False, False) \end{verbatim} \end{small} -\end{cpdflib} +\end{pycpdflib} + \pagestyle{plain} \tableofcontents\clearpage\pagestyle{empty} diff --git a/pysplits/c00.tex b/pysplits/c00.tex index 9d9a8fe..78fbb86 100644 --- a/pysplits/c00.tex +++ b/pysplits/c00.tex @@ -1,8 +1,8 @@ -"""Pycpdf: a python interface to cpdf. +"""Pycpdflib: a python interface to cpdf. Before using the library, you must load the libpycpdf and libcpdf DLLs. This is -achieved with the pycpdf.loadDLL function, given the filename or full path of -the libpycpdf DLL. On Windows, you may have to call os.add_dll_directory +achieved with the pycpdflib.loadDLL function, given the filename or full path +of the libpycpdf DLL. On Windows, you may have to call os.add_dll_directory first. On MacOS, you may need to give the full path, and you may need to install libcpdf.so in a standard location /usr/local/lib/, or use the install_name_tool command to tell libpycpdf.so where to find libcpdf.so. diff --git a/pysplits/c01.tex b/pysplits/c01.tex index 13c3f93..c3a14ea 100644 --- a/pysplits/c01.tex +++ b/pysplits/c01.tex @@ -2,7 +2,7 @@ Loading the libpypcdf and libcpdf DLLs -------------------------------------- Before using the library, you must load the ``libpycpdf`` and ``libcpdf`` DLLs. -This is achieved with the ``pycpdf.loadDLL`` function, given the filename or +This is achieved with the ``pycpdflib.loadDLL`` function, given the filename or full path of the ``libpycpdf`` DLL. On Windows, you may have to call ``os.add_dll_directory`` first. On MacOS, you