Set a watermark.
int xpdfSpliceSetWatermark(XpdfSpliceOutputHandle out, XpdfSpliceInputHandle watermarkIn, int watermarkPageNum, double alpha, int flags)
This function sets a watermark to be included on subsequent calls to xpdfSpliceAddPage, etc. XpdfSplice will use page number watermarkPageNum from document watermarkIn as a watermark.

If the flags argument is 0, the watermark page will be drawn under the content page. On each output page, XpdfSplice draws the watermark page (as specified in the xpdfSpliceSetWatermark call) first, and then draws the content page (as specified in xpdfSpliceAddPage). If the content page draws on the same region as the watermark page, the watermark will be hidden.

If the flags argument is xpdfSpliceWatermarkOver, the watermark page will be drawn over the content page. On each output page, XpdfSplice draws the content page, and then the watermark page. The watermark will cover up the content (but see the alpha argument description below).

The watermark page should be the same size and orientation as the content page.

The alpha argument sets the opacity of the watermark. 1.0 is fully opaque, and 0.0 is fully transparent (invisible). For example: 0.9 is 90% opaque, and 0.1 is 10% opaque (nearly invisible).

The watermark document, watermarkIn, should be opened with one of the input document functions: xpdfSpliceOpenInput, etc. It must not be closed until all calls to xpdfSpliceAddPage have been made.

Calling xpdfSpliceSetWatermark again will set a new watermark, replacing the old one. Subsequent calls to xpdfSpliceAddPage will use the new watermark. (Pages added before this will not be modified.) You can use any number of different watermarks in one output file.

Calling xpdfSpliceSetWatermark(out, NULL, 0, 0, 0) will remove the watermark setting for subsequent pages.

contentIn = xpdfSpliceOpenInput("content.pdf"); out = xpdfSpliceOpenOutput("out.pdf", 1.7); // use page 1 of watermark1.pdf as the watermark watermarkIn1 = xpdfSpliceOpenInput("watermark1.pdf"); xpdfSpliceSetWatermark(out, watermarkIn1, 1, 1.0, 0); // copy pages 1-10 from content.pdf, using that watermark xpdfSpliceAddPages(contentIn, 1, 10, out); // use page 7 of watermark2.pdf as the watermark, drawing over the // content with 50% transparency xpdfSpliceCloseInput(watermarkIn1); watermarkIn2 = xpdfSpliceOpenInput("watermark2.pdf"); xpdfSpliceSetWatermark(out, watermarkIn2, 7, 0.5, xpdfSpliceWatermarkOver); // copy pages 11-20 from content.pdf, using that watermark xpdfSpliceAddPages(contentIn, 11, 20, out); // no watermark xpdfSpliceCloseInput(watermarkIn2); xpdfSpliceSetWatermark(out, NULL, 0, 0); // copy pages 21-30 from content.pdf, with no watermark xpdfSpliceAddPages(in, 21, 30, out); xpdfSpliceCloseOutput(out); xpdfSpliceCloseInput(contentIn);