This commit is contained in:
John Whitington 2022-03-07 17:38:41 +00:00
parent 4046437b85
commit f83d8abb5d
2 changed files with 29 additions and 34 deletions

Binary file not shown.

View File

@ -1,6 +1,6 @@
\documentclass{book} \documentclass{book}
% Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf etc. % Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf etc.
\usepackage{comment}\excludecomment{cpdflib}\excludecomment{pycpdflib}\includecomment{dotnetcpdflib} \usepackage{comment}\excludecomment{cpdflib}\excludecomment{pycpdflib}\excludecomment{dotnetcpdflib}
\usepackage{palatino} \usepackage{palatino}
\usepackage{listings} \usepackage{listings}
\usepackage{microtype} \usepackage{microtype}
@ -410,26 +410,23 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using CoherentGraphics; using CoherentGraphics;
public static void Main(string[] args) // Initialise cpdf
Cpdf.startup();
// We will take the input hello.pdf and repeat it three times
using (Cpdf.Pdf mergepdf = Cpdf.fromFile("hello.pdf", ""))
{ {
// Initialise cpdf // The list of PDFs to merge
Cpdf.startup(); List<Cpdf.Pdf> pdfs = new List<Cpdf.Pdf> {mergepdf, mergepdf, mergepdf};
// We will take the input hello.pdf and repeat it three times // Merge them
using (Cpdf.Pdf mergepdf = Cpdf.fromFile("hello.pdf", "")) Cpdf.Pdf merged = Cpdf.mergeSimple(pdfs);
{
// The list of PDFs to merge
List<Cpdf.Pdf> pdfs = new List<Cpdf.Pdf> {mergepdf, mergepdf, mergepdf};
// Merge them // Write output
Cpdf.Pdf merged = Cpdf.mergeSimple(pdfs); Cpdf.toFile(merged, "merged.pdf", false, false);
// Write output // Dispose of merged PDF
Cpdf.toFile(merged, "merged.pdf", false, false); merged.Dispose();
// Dispose of merged PDF
merged.Dispose();
}
} }
\end{verbatim} \end{verbatim}
\end{small} \end{small}
@ -448,26 +445,24 @@ imports System
imports System.Collections.Generic imports System.Collections.Generic
imports CoherentGraphics imports CoherentGraphics
Sub Main(args as String()) ' Initialise cpdf
' Initialise cpdf Cpdf.startup()
Cpdf.startup()
' We will take the input hello.pdf and repeat it three times ' We will take the input hello.pdf and repeat it three times
Using mergepdf As Cpdf.Pdf = Cpdf.fromFile("hello.pdf", "") Using mergepdf As Cpdf.Pdf = Cpdf.fromFile("hello.pdf", "")
' The list of PDFs to merge ' The list of PDFs to merge
Dim pdfs As List(Of Cpdf.Pdf) = Dim pdfs As List(Of Cpdf.Pdf) =
new List(Of Cpdf.Pdf)({mergepdf, mergepdf, mergepdf}) new List(Of Cpdf.Pdf)({mergepdf, mergepdf, mergepdf})
' Merge them ' Merge them
Dim merged As Cpdf.Pdf = Cpdf.mergeSimple(pdfs) Dim merged As Cpdf.Pdf = Cpdf.mergeSimple(pdfs)
' Write output ' Write output
Cpdf.toFile(merged, "merged.pdf", false, false) Cpdf.toFile(merged, "merged.pdf", false, false)
' Dispose of merged PDF ' Dispose of merged PDF
merged.Dispose() merged.Dispose()
End Using End Using
End Sub
\end{verbatim} \end{verbatim}
\end{small} \end{small}