setWatermark

Set a watermark.
setWatermark([in] LONG outputHandle, [in] LONG watermarkInputHandle, [in] int watermarkPage, [in] double alpha, [in] int flags)
This function sets a watermark to be included on subsequent calls to addPage, etc. XpdfSplice will use page number watermarkPage from document watermarkInputHandle 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 setWatermark call) first, and then draws the content page (as specified in addPage). If the content page draws on the same region as the watermark page, the watermark will be hidden.

If the flags argument is pdf.watermarkOver, 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, watermarkInputHandle, should be opened with one of the input document functions: openInput, etc. It must not be closed until all calls to addPage have been made.

Calling setWatermark again will set a new watermark, replacing the old one. Subsequent calls to addPage 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 setWatermark(out, 0, 0, 0, 0) will remove the watermark setting for subsequent pages.

VB6:
contentIn = pdf.openInput("content.pdf") out = pdf.openOutput("out.pdf", 1.7) ' use page 1 of watermark1.pdf as the watermark watermarkIn1 = pdf.openInput("watermark1.pdf") pdf.setWatermark out, watermarkIn1, 1, 1.0, 0 ' copy pages 1-10 from content.pdf, using that watermark pdf.addPages contentIn, 1, 10, out ' use page 7 of watermark2.pdf as the watermark, drawing over the ' content with 50% transparency pdf.closeInput watermarkIn1 watermarkIn2 = pdf.openInput("watermark2.pdf") pdf.setWatermark out, watermarkIn2, 7, 0.5, pdf.watermarkOver ' copy pages 11-20 from content.pdf, using that watermark pdf.addPages contentIn, 11, 20, out ' no watermark pdf.closeInput watermarkIn2 pdf.setWatermark out, 0, 0, 0 ' copy pages 21-30 from content.pdf, with no watermark pdf.addPages contentIn, 21, 30, out pdf.closeOutput out pdf.closeInput contentIn