more
This commit is contained in:
parent
a5916998ae
commit
7a62b5ab47
BIN
cpdfmanual.pdf
BIN
cpdfmanual.pdf
Binary file not shown.
|
@ -4,7 +4,7 @@
|
||||||
\excludecomment{cpdflib}
|
\excludecomment{cpdflib}
|
||||||
\excludecomment{pycpdflib}
|
\excludecomment{pycpdflib}
|
||||||
\excludecomment{dotnetcpdflib}
|
\excludecomment{dotnetcpdflib}
|
||||||
\includecomment{jcpdflib}
|
\excludecomment{jcpdflib}
|
||||||
\usepackage{palatino}
|
\usepackage{palatino}
|
||||||
\usepackage{listings}
|
\usepackage{listings}
|
||||||
\usepackage{microtype}
|
\usepackage{microtype}
|
||||||
|
@ -486,32 +486,41 @@ document with the original included three times.
|
||||||
\begin{small}
|
\begin{small}
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
//Merge example
|
//Merge example
|
||||||
using System;
|
import Jcpdf
|
||||||
using System.Collections.Generic;
|
|
||||||
using CoherentGraphics;
|
|
||||||
|
|
||||||
// Initialise cpdf
|
public static void main(String[] args)
|
||||||
Cpdf.startup();
|
|
||||||
|
|
||||||
// We will take the input hello.pdf and repeat it three times
|
|
||||||
using (Cpdf.Pdf mergepdf = Cpdf.fromFile("hello.pdf", ""))
|
|
||||||
{
|
{
|
||||||
// The list of PDFs to merge
|
// Initialise cpdf
|
||||||
List<Cpdf.Pdf> pdfs = new List<Cpdf.Pdf> {mergepdf, mergepdf, mergepdf};
|
Jcpdf jcpdf = new Jcpdf();
|
||||||
|
try
|
||||||
// Merge them
|
{
|
||||||
Cpdf.Pdf merged = Cpdf.mergeSimple(pdfs);
|
jcpdf.startup();
|
||||||
|
}
|
||||||
// Write output
|
catch (Jcpdf.CpdfError e)
|
||||||
Cpdf.toFile(merged, "merged.pdf", false, false);
|
{
|
||||||
|
System.out.println("Error during cpdf startup");
|
||||||
// Dispose of merged PDF
|
}
|
||||||
merged.Dispose();
|
// We will take the input hello.pdf and repeat it three times
|
||||||
|
try (Jcpdf.Pdf mergepdf = jcpdf.fromFile("hello.pdf", ""))
|
||||||
|
{
|
||||||
|
// The array of PDFs to merge
|
||||||
|
Jcpdf.Pdf[] pdfs = {mergepdf, mergepdf, mergepdf};
|
||||||
|
// Merge them
|
||||||
|
Jcpdf.Pdf merged = jcpdf.mergeSimple(pdfs);
|
||||||
|
// Write output
|
||||||
|
jcpdf.toFile(merged, "merged.pdf", false, false);
|
||||||
|
// Dispose of merged PDF
|
||||||
|
merged.close();
|
||||||
|
}
|
||||||
|
catch (Jcpdf.CpdfError e)
|
||||||
|
{
|
||||||
|
System.out.println("Error during cpdf operation");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
\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.
|
\noindent Note the use of \texttt{try} and \texttt{close()} to ensure the PDFs are thrown away when no longer required.
|
||||||
\end{jcpdflib}
|
\end{jcpdflib}
|
||||||
|
|
||||||
\pagestyle{plain}
|
\pagestyle{plain}
|
||||||
|
|
Loading…
Reference in New Issue