Example Program in JavaScript

This program loads a file hello.pdf from disk and writes out a document with the original included three times.

//Merge example

//Load coherentpdf.js
const coherentpdf = require(./coherentpdf.js);

//Load the file hello.pdf from the current directory
var pdf = coherentpdf.fromFile(hello.pdf, );

//Merge three copies of it
var merged = coherentpdf.mergeSimple([pdf, pdf, pdf]);

//Write to merged.pdf
coherentpdf.toFile(merged, merged.pdf, false, false);

//Clean up the two PDFs
coherentpdf.deletePdf(pdf);
coherentpdf.deletePdf(merged);

To be run in node. A browser example is included in the distribution of coherentpdf.js.