Watermark
Document Watermark
A visible or invisible mark embedded in a document to indicate ownership, status, or confidentiality.
Technical Detail
In the PDF specification (ISO 32000-2:2020), watermark is implemented as a specialized object within the document's object graph. PDF files use a cross-reference table to index every object by byte offset, enabling random access without sequential parsing. This architecture allows watermark to be read, modified, or extracted independently of other document elements. The binary structure supports incremental saves, where changes append to the file without rewriting existing content.
Example
```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),
});
}
```