# Watermark

Diagonal or centered watermark overlay.

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any docs URL. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).

## Installation

```bash
npx shadcn@latest add @angular-pdfcn/takumi/watermark
```

To install manually, add the dependencies:

```bash
npm install takumi-pdf @takumi-rs/helpers
```

Then copy these files into your project and update the import paths to match your setup:

- `components/pdf/watermark/watermark.ts`
- `lib/resolve-color.ts`
- `components/pdf/theme-provider.ts`
- `lib/pdf-renderer.ts`
- `lib/pdf-primitives.ts`
- `lib/render.ts`
- `lib/pdf-themes/professional.ts`
- `lib/pdf-themes/primitives.ts`
- `types/pdf-themes.ts`
- `types/pdf-components.ts`

## Usage

```ts
import { Component } from "@angular/core";

import { PdfHeading } from "@/components/pdf/heading/heading";
import { PdfText } from "@/components/pdf/text/text";
import { PdfcnThemeProvider } from "@/components/pdf/theme-provider";
import { PdfWatermark } from "@/components/pdf/watermark/watermark";
import {
  TakumiDocument,
  TakumiPage,
  TakumiView,
} from "@/lib/pdf-primitives";

@Component({
  imports: [
    TakumiDocument,
    TakumiPage,
    TakumiView,
    PdfcnThemeProvider,
    PdfHeading,
    PdfText,
    PdfWatermark,
  ],
  template: `
    <takumi-document>
      <takumi-page size="A4">
        <pdf-theme-provider>
          <takumi-view [style]="{ minHeight: 680, position: 'relative' }">
            <pdf-watermark text="DRAFT" />
            <pdf-heading [level]="1">Draft Document</pdf-heading>
            <pdf-text
              >This report is under review and should not be distributed
              externally.</pdf-text
            >
            <pdf-text
              >The watermark sits behind the content while remaining clearly
              visible.</pdf-text
            >
            <pdf-text
              >Use watermarks for draft, confidential, sample, or approval
              states.</pdf-text
            >
          </takumi-view>
        </pdf-theme-provider>
      </takumi-page>
    </takumi-document>
  `,
})
export class WatermarkDemo {}
```

## API Reference

### PdfWatermark

| Input      | Type                                                                       | Default |
| ---------- | -------------------------------------------------------------------------- | ------- |
| `text`     | `string`                                                                   | -       |
| `opacity`  | `number`                                                                   | -       |
| `fontSize` | `number`                                                                   | -       |
| `color`    | `string`                                                                   | -       |
| `angle`    | `number`                                                                   | -       |
| `position` | `'center' \| 'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right'` | -       |
| `fixed`    | `boolean`                                                                  | `true`  |