From 6841f0b6eec6b2fcb0a61bd969b5ef9c4be3c51f Mon Sep 17 00:00:00 2001 From: John Whitington Date: Fri, 18 Jun 2021 15:08:56 +0100 Subject: [PATCH] more --- cpdfmanual.pdf | Bin 256746 -> 256746 bytes cpdfmanual.tex | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/cpdfmanual.pdf b/cpdfmanual.pdf index 7a718e92437ea7660058c2b3fb79e264d7fcf8a7..76ead7a39105c8a1c063fb367e8d9d270722b0f1 100644 GIT binary patch delta 116 zcmaELmH*XM{)QID7N#xCx302V7@8Vb7+Fkzc$HZO#@Wttjk%K3*~rnz(Am)3$impf l&D7c1!otYZ$jHpe)yT-i*wW0{#7@D6kdo~O?lWs~0{|$aAVB~C delta 116 zcmaELmH*XM{)QID7N#xCx301q7+M$`7#dE0c$HZO#@Wttjk%K3*~!Av!qvsd)zHGk j&Dg@s#Tm#oaB?#>b1`!=bu>1%Q?MbVWcz{p%v#(4La-qd diff --git a/cpdfmanual.tex b/cpdfmanual.tex index 31cf424..aba669e 100644 --- a/cpdfmanual.tex +++ b/cpdfmanual.tex @@ -1,4 +1,6 @@ \documentclass{book} +% Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf etc. +\usepackage{comment}\excludecomment{cpdflib} \usepackage{palatino} \usepackage{microtype} \usepackage{graphics} @@ -16,7 +18,6 @@ \fancyhead[lo]{\slshape\nouppercase{\leftmark}\hfill\thepage} \fancyhead[re]{\thepage\hfill\slshape\nouppercase{\leftmark}} \fancyfoot{} -%\fancyfoot[LE,RO]{\thepage} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt} \begin{document} @@ -282,6 +283,52 @@ A sampling of just a few of the facilities provided by the Coherent PDF Command % Letter \pagestyle{empty} \cleardoublepage + +\begin{cpdflib} +\chapter{Example Program in C} + +This program loads a file \texttt{hello.pdf} from disk and writes out a document with the original included three times. Note the use of \texttt{cpdf\_startup}, \texttt{cpdf\_lastError} and \texttt{cpdf\_clearError}. + +\begin{small} +\begin{verbatim} +#include +#include "cpdflibwrapper.h" + +int main (int argc, char ** argv) +{ + /* Initialise cpdf */ + cpdf_startup(argv); + + /* We will take the input hello.pdf and repeat it three times */ + int mergepdf = cpdf_fromFile("hello.pdf", ""); + + /* Check the error state */ + if (cpdf_lastError) return 1; + + /* Clear the error state */ + cpdf_clearError(); + + /* The array of PDFs to merge */ + int pdfs[] = {mergepdf, mergepdf, mergepdf}; + + /* Merge them */ + int merged = cpdf_mergeSimple(pdfs, 3); + + if (cpdf_lastError) return 1; + + cpdf_clearError(); + + /* Write output */ + cpdf_toFile(merged, "merged.pdf", false, false); + + if (cpdf_lastError) return 1; + + return 0; +} +\end{verbatim} +\end{small} +\end{cpdflib} + \pagestyle{plain} \tableofcontents\clearpage\pagestyle{empty}