Watermark
Watermark (Document Overlay Mark)
A visible or invisible mark placed on a document or image to indicate ownership, copyright, confidentiality status, or draft state, typically appearing as semi-transparent text or a logo behind the main content.
ๆ่ก็่ฉณ็ดฐ
PDF watermarks can be implemented as page content (drawn into the content stream with transparency), annotations (overlay objects), or through the optional content group mechanism. Visible watermarks use transparency operators (gs with /ca or /CA) to render text like 'CONFIDENTIAL' or 'DRAFT' at reduced opacity. Invisible watermarks embed identifying data in ways imperceptible to viewers, such as micro-adjustments to character spacing or steganographic pixel patterns in images.
ไพ
```javascript
// Add text watermark to PDF pages
const pages = pdf.getPages();
for (const page of pages) {
page.drawText('CONFIDENTIAL', {
x: page.getWidth() / 2 - 100,
y: page.getHeight() / 2,
size: 48,
opacity: 0.2,
rotate: degrees(45),
});
}
```