more
This commit is contained in:
parent
a0e93444b9
commit
d2266c32bf
BIN
cpdfmanual.pdf
BIN
cpdfmanual.pdf
Binary file not shown.
111
cpdfmanual.tex
111
cpdfmanual.tex
|
@ -405,32 +405,37 @@ document with the original included three times.
|
||||||
|
|
||||||
\begin{small}
|
\begin{small}
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
#Merge example
|
//Merge example
|
||||||
import pycpdflib
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using CoherentGraphics;
|
||||||
|
|
||||||
#DLL loading depends on your own platform. These are the author's settings.
|
public static void Main(string[] args)
|
||||||
if sys.platform.startswith('darwin'):
|
{
|
||||||
pycpdflib.loadDLL("/Users/john/repos/python-libcpdf/libpycpdf.so")
|
// Initialise cpdf
|
||||||
elif sys.platform.startswith('linux'):
|
Cpdf.startup();
|
||||||
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
|
// We will take the input hello.pdf and repeat it three times
|
||||||
mergepdf = pycpdf.fromFile('hello.pdf', '')
|
using (Cpdf.Pdf mergepdf = Cpdf.fromFile("hello.pdf", ""))
|
||||||
|
{
|
||||||
|
// The list of PDFs to merge
|
||||||
|
List<Cpdf.Pdf> pdfs = new List<Cpdf.Pdf> {mergepdf, mergepdf, mergepdf};
|
||||||
|
|
||||||
#The list of PDFs to merge
|
// Merge them
|
||||||
pdfs = [mergepdf, mergepdf, mergepdf]
|
Cpdf.Pdf merged = Cpdf.mergeSimple(pdfs);
|
||||||
|
|
||||||
#Merge them
|
// Write output
|
||||||
merged = pycpdflib.mergeSimple(pdfs)
|
Cpdf.toFile(merged, "merged.pdf", false, false);
|
||||||
|
|
||||||
#Write output
|
// Dispose of merged PDF
|
||||||
pycpdflib.toFile(merged, 'merged.pdf', False, False)
|
merged.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
\end{small}
|
\end{small}
|
||||||
|
|
||||||
|
\noindent Note the use of \texttt{using} and \texttt{Dispose()} to ensure the PDFs are thrown away when no longer required.
|
||||||
|
|
||||||
\chapter*{Example Program in VB.NET}
|
\chapter*{Example Program in VB.NET}
|
||||||
|
|
||||||
This program loads a file \texttt{hello.pdf} from disk and writes out a
|
This program loads a file \texttt{hello.pdf} from disk and writes out a
|
||||||
|
@ -438,64 +443,36 @@ document with the original included three times.
|
||||||
|
|
||||||
\begin{small}
|
\begin{small}
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
#Merge example
|
' Merge example
|
||||||
import pycpdflib
|
imports System
|
||||||
|
imports System.Collections.Generic
|
||||||
|
imports CoherentGraphics
|
||||||
|
|
||||||
#DLL loading depends on your own platform. These are the author's settings.
|
Sub Main(args as String())
|
||||||
if sys.platform.startswith('darwin'):
|
' Initialise cpdf
|
||||||
pycpdflib.loadDLL("/Users/john/repos/python-libcpdf/libpycpdf.so")
|
Cpdf.startup()
|
||||||
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
|
' We will take the input hello.pdf and repeat it three times
|
||||||
mergepdf = pycpdf.fromFile('hello.pdf', '')
|
Using mergepdf As Cpdf.Pdf = Cpdf.fromFile("hello.pdf", "")
|
||||||
|
' The list of PDFs to merge
|
||||||
|
Dim pdfs As List(Of Cpdf.Pdf) =
|
||||||
|
new List(Of Cpdf.Pdf)({mergepdf, mergepdf, mergepdf})
|
||||||
|
|
||||||
#The list of PDFs to merge
|
' Merge them
|
||||||
pdfs = [mergepdf, mergepdf, mergepdf]
|
Dim merged As Cpdf.Pdf = Cpdf.mergeSimple(pdfs)
|
||||||
|
|
||||||
#Merge them
|
' Write output
|
||||||
merged = pycpdflib.mergeSimple(pdfs)
|
Cpdf.toFile(merged, "merged.pdf", false, false)
|
||||||
|
|
||||||
#Write output
|
' Dispose of merged PDF
|
||||||
pycpdflib.toFile(merged, 'merged.pdf', False, False)
|
merged.Dispose()
|
||||||
|
End Using
|
||||||
|
End Sub
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
\end{small}
|
\end{small}
|
||||||
|
|
||||||
\chapter*{Example Program in F\#}
|
\noindent Note the use of \texttt{Using} and \texttt{Dispose()} to ensure the PDFs are thrown away when no longer required.
|
||||||
|
|
||||||
This program loads a file \texttt{hello.pdf} from disk and writes out a
|
|
||||||
document with the original included three times.
|
|
||||||
|
|
||||||
\begin{small}
|
|
||||||
\begin{verbatim}
|
|
||||||
#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{dotnetcpdflib}
|
\end{dotnetcpdflib}
|
||||||
|
|
||||||
\pagestyle{plain}
|
\pagestyle{plain}
|
||||||
|
|
Loading…
Reference in New Issue