We use the Stamper to stamp page numbers to every page in a PDF document using the stamper.stampText() method.
We expected setAsBackground(true) would stamp the text as a (visible) watermark which is in the background and thus not selectable. This seems not the case.
setAsBackground() controls the z-order of stamped content. If you stamp with setAsBackground(true), the stamp appears underneath existing content. If you stamp with setAsBackground(false), the stamp appears atop existing content. It does not affect the content of the stamp (i.e., whether the stamp is text or an image).
If you want to make Stamper text non-selectable, you have a couple of options.
One approach would be to ‘flatten’ or ‘rasterize’ the watermark so that it is an image, and not text. This would have the downside of making the watermark non-scalable/non-vector, so it would be blurry at high magnification.
See this forum posting for more information:
Another approach would be to convert your stamp to a vector PDF page (e.g. in Illustrator) without any text. Then you could Stamp() the PDF with Stamper.StampPage().