2022-05-18 18:47:31 +02:00
|
|
|
// CHAPTER 8. Logos, Watermarks and Stamps
|
|
|
|
|
|
|
|
/** A stamping function with extra features. - isover true, pdf goes over pdf2,
|
|
|
|
isover false, pdf goes under pdf2 - scale_stamp_to_fit scales the stamp to fit
|
|
|
|
the page - pos gives the position to put the stamp - relative_to_cropbox: if
|
|
|
|
true, pos is relative to cropbox not mediabox. */
|
|
|
|
function stampOn(stamp_pdf, pdf, range)
|
|
|
|
|
|
|
|
/** Stamps stamp_pdf under all the pages in the document which are in the
|
2022-05-12 17:57:13 +02:00
|
|
|
range. The stamp is placed with its origin at the origin of the target
|
2022-05-18 18:47:31 +02:00
|
|
|
document. */
|
|
|
|
function stampUnder(stamp_pdf, pdf, range)
|
|
|
|
|
|
|
|
/** A stamping function with extra features. - isover true, pdf goes over
|
|
|
|
pdf2, isover false, pdf goes under pdf2 - scale_stamp_to_fit scales the
|
|
|
|
stamp to fit the page - pos gives the position to put the stamp -
|
|
|
|
relative_to_cropbox: if true, pos is relative to cropbox not mediabox. */
|
|
|
|
function stampExtended(pdf, pdf2, range, isover, scale_stamp_to_fit, position,
|
|
|
|
relative_to_cropbox)
|
|
|
|
|
|
|
|
/** Combines the PDFs page-by-page, putting each page of 'over' over each page
|
|
|
|
of 'under'. */
|
|
|
|
function combinePages(under, over)
|
|
|
|
|
|
|
|
/** Adds text to the pages in the given range. */
|
|
|
|
function addText(metrics, pdf, range, text, position, linespacing,
|
|
|
|
bates, font, fontsize, r, g, b, underneath, relative_to_cropbox,
|
|
|
|
outline, opacity, justification, midline, topline, filename,
|
|
|
|
linewidth, embed_fonts)
|
|
|
|
|
|
|
|
/** Adds text with most parameters default. */
|
|
|
|
function addTextSimple(pdf, range, text, position, font, fontsize)
|
|
|
|
|
|
|
|
/** Removes any text added by cpdf from the given pages. */
|
|
|
|
function removeText(pdf, range)
|
|
|
|
|
|
|
|
/** Returns the width of a given string in the given font in thousandths of a
|
|
|
|
point. */
|
|
|
|
function textWidth(font, text)
|
|
|
|
|
|
|
|
/** Adds page content before (if true) or after (if false) the existing
|
|
|
|
content to pages in the given range in the given PDF. */
|
|
|
|
function addContent(content, before, pdf, range)
|
|
|
|
|
|
|
|
/** Stamps stamp_pdf onto the pages in the given range in pdf as a shared Form
|
|
|
|
XObject. The name of the newly-created XObject is returned. */
|
|
|
|
function stampAsXObject(pdf, range, stamp_pdf)
|