From c427f79d8bc0bf74dd6b7447127776ec21457c35 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Sun, 26 Sep 2021 16:24:19 +0100 Subject: [PATCH] more --- cpdfmanual.pdf | Bin 256054 -> 256054 bytes cpdfmanual.tex | 29 ++++++++++++++++++++++++++--- pysplits/c00.tex | 6 +++--- pysplits/c01.tex | 2 +- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/cpdfmanual.pdf b/cpdfmanual.pdf index 7e1043fc09088dde0cd76a88625dc27e877fd846..4eb7fb1d836f1283a0672fb1b94f36bb8a135713 100644 GIT binary patch delta 142 zcmdmXfq&Zt{)QID7N#xC9hdct%nZ$pjE&8;4Gh%{4AeEb^nLSFToOxC6*OF|j0}tn z4J?tAY~Oa7S&7rx(9+S!&D71+%-qb`z}U#mz{SMP&D7P>*vZ-0z|qLbPQiwdlI_xW HnWeb_^FJiT delta 142 zcmdmXfq&Zt{)QID7N#xC9hdbC3=J(!3`|Y54UE(c4AeEb^nLSFToOxC6*OF|j0}tn z4J?tAY~Oa7S&7rx*u}!!*wxU?($Uq_$v!pPLpPQiwdlI_xW HnWeb_-F751 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