# PDF にテキスト透かしを追加する

PDF の各ページに最大3行のテキスト透かしを付与します。テンプレート、色、不透明度を指定できます。

PDF ドキュメントにテキスト透かしを追加します。最大3行までのテキストを指定し、テンプレート、色、透明度、余白を制御できます。デフォルトでは透かしはすべてのページに付与されます。特定のページだけを対象にするには、[`pages`](#ページの選択) パラメーターを使用します。API はステートレスです。ドキュメントはリージョン内で処理され、保存されることはありません。

## エンドポイント

<Endpoint method="POST" path="/v1/add_text_watermark" />

すべてのリージョンで利用できます。ルーティングとデータレジデンシーについては、[リージョンとデータレジデンシー](/docs/api/regions-and-data-residency)を参照してください。

| リージョン       | URL                                                     |
| -------------- | -------------------------------------------------------- |
| グローバル       | `https://api.pdfblocks.com/v1/add_text_watermark`        |
| 日本            | `https://jp.api.pdfblocks.com/v1/add_text_watermark`     |
| 米国            | `https://us.api.pdfblocks.com/v1/add_text_watermark`     |
| HIPAA 米国      | `https://hipaa.api.pdfblocks.com/v1/add_text_watermark`  |
| 欧州連合         | `https://eu.api.pdfblocks.com/v1/add_text_watermark`     |
| 英国            | `https://uk.api.pdfblocks.com/v1/add_text_watermark`     |
| カナダ           | `https://ca.api.pdfblocks.com/v1/add_text_watermark`     |
| オーストラリア    | `https://au.api.pdfblocks.com/v1/add_text_watermark`     |
| インド           | `https://in.api.pdfblocks.com/v1/add_text_watermark`     |
| ブラジル         | `https://br.api.pdfblocks.com/v1/add_text_watermark`     |

## 認証

すべてのリクエストは、HTTPS 経由で `X-API-Key` ヘッダーにシークレット API キーを設定して認証してください。キーの作成と管理は[ダッシュボード](https://dashboard.pdfblocks.com)から行います。詳細は[認証](/docs/api/authentication)を参照してください。

## リクエスト

このエンドポイントは `multipart/form-data` 形式のリクエストボディを受け付けます。

<ParamField name="file" type="file" required>
  入力する PDF ドキュメント。
</ParamField>

<ParamField name="line_1" type="string" required>
  透かしテキストの1行目。最大32文字。標準的なラテン文字を使用してください。
</ParamField>

<ParamField name="line_2" type="string">
  透かしテキストの2行目。最大32文字。
</ParamField>

<ParamField name="line_3" type="string">
  透かしテキストの3行目。最大32文字。
</ParamField>

<ParamField name="pages" type="string">
  透かしを付与するページを、`1..3,5` のような[ページ範囲](#ページの選択)として指定します。省略した場合、透かしはすべてのページに適用されます。最大1000文字です。
</ParamField>

<ParamField name="template" type="integer" default="1001">
  透かしの[テンプレート](#透かしテンプレート)。スタイル（塗りつぶしまたは輪郭）と向きを設定します。
</ParamField>

<ParamField name="color" type="string" default="Gray">
  透かしの[色](#色)。`Red`、`Blue`、`Gray`、`Black` のいずれかを指定します。
</ParamField>

<ParamField name="transparency" type="integer" default="75">
  透明度のレベル。`0`（完全に不透明）から `100`（完全に透明）までの値を指定します。
</ParamField>

<ParamField name="margin" type="decimal" default="1.0">
  ページの端から透かしまでの距離をインチで指定します。`0` 以上の値を指定します。
</ParamField>

### 透かしテンプレート

各 `template` は、**スタイル**（塗りつぶしまたは輪郭）と**向き**を組み合わせたものです。`template` パラメーターに ID を渡します。

| テンプレート | スタイル | 向き                                       |
| -------- | ------- | ---------------------------------------------- |
| `1001`   | 塗りつぶし  | 対角、左下から右上 *(デフォルト)*                    |
| `1002`   | 塗りつぶし  | 対角、左上から右下                                |
| `1003`   | 塗りつぶし  | 水平                                            |
| `1004`   | 塗りつぶし  | 垂直、下から上に読む                              |
| `1005`   | 塗りつぶし  | 垂直、上から下に読む                              |
| `1017`   | 輪郭      | 対角、左下から右上                                |
| `1018`   | 輪郭      | 対角、左上から右下                                |
| `1019`   | 輪郭      | 水平                                            |
| `1020`   | 輪郭      | 垂直、下から上に読む                              |
| `1021`   | 輪郭      | 垂直、上から下に読む                              |

<Tip>
  すべてのテンプレートをサンプルページ上で確認できる[テンプレート一覧（PDF）](https://pdfblocks.com/assets/documents/pdfblocks-watermark-templates.pdf)を参照してください。
</Tip>

### 色

| 値      | 見本        |
| ------- | --------- |
| `Red`   | `#C00000` |
| `Blue`  | `#005DFF` |
| `Gray`  | `#545454` |
| `Black` | `#000000` |

### ページの選択

`pages` パラメーターには、1から始まるページ番号と範囲をカンマ区切りで指定します。これは**集合**として扱われるため、順序や重複は無視され、ページは常にドキュメントの順序で透かしが付与されます。

| パターン | 選択されるページ |
| --------- | ------------------------------------------ |
| *(省略)*  | すべてのページ                               |
| `1`       | 最初のページのみ                             |
| `1..3,5`  | ページ1、2、3、5                             |
| `2..`     | ページ2から最後のページまで                   |
| `..-2`    | 最初のページから最後から2番目のページまで        |
| `-1`      | 最後のページ                                 |

完全なリファレンスについては[ページの選択](/docs/api/selecting-pages)を参照してください。

## 例

ページ1〜3と5に2行のテキスト透かしを付与する例：

<CodeGroup>

```bash title="cURL"
curl https://api.pdfblocks.com/v1/add_text_watermark \
  -H 'X-API-Key: your_api_key' \
  -F file=@input.pdf \
  -F line_1='CONFIDENTIAL' \
  -F line_2='ACME, Inc.' \
  -F template=1001 \
  -F color=Red \
  -F pages='1..3,5' \
  -o watermarked.pdf
```

```python title="Python"
# pip install requests
import requests

with open('input.pdf', 'rb') as file:
    response = requests.post(
        'https://api.pdfblocks.com/v1/add_text_watermark',
        headers={'X-API-Key': 'your_api_key'},
        files={'file': file},
        data={
            'line_1': 'CONFIDENTIAL',
            'line_2': 'ACME, Inc.',
            'template': 1001,
            'color': 'Red',
            'pages': '1..3,5',
        },
    )

response.raise_for_status()
with open('watermarked.pdf', 'wb') as output:
    output.write(response.content)
```

```javascript title="Node.js"
// Node.js 18+
import { readFile, writeFile } from 'node:fs/promises';

const body = new FormData();
body.set('file', new Blob([await readFile('input.pdf')]), 'input.pdf');
body.set('line_1', 'CONFIDENTIAL');
body.set('line_2', 'ACME, Inc.');
body.set('template', '1001');
body.set('color', 'Red');
body.set('pages', '1..3,5');

const response = await fetch('https://api.pdfblocks.com/v1/add_text_watermark', {
  method: 'POST',
  headers: { 'X-API-Key': 'your_api_key' },
  body,
});

if (!response.ok) throw new Error(`Request failed: ${response.status}`);
await writeFile('watermarked.pdf', Buffer.from(await response.arrayBuffer()));
```

```php title="PHP"
<?php
$ch = curl_init('https://api.pdfblocks.com/v1/add_text_watermark');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['X-API-Key: your_api_key'],
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => [
        'file' => new CURLFile('input.pdf', 'application/pdf'),
        'line_1' => 'CONFIDENTIAL',
        'line_2' => 'ACME, Inc.',
        'template' => '1001',
        'color' => 'Red',
        'pages' => '1..3,5',
    ],
]);

$pdf = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) === 200) {
    file_put_contents('watermarked.pdf', $pdf);
}
```

```ruby title="Ruby"
# gem install http
require 'http'

response = HTTP
  .headers('X-API-Key' => 'your_api_key')
  .post('https://api.pdfblocks.com/v1/add_text_watermark', form: {
    file: HTTP::FormData::File.new('input.pdf'),
    line_1: 'CONFIDENTIAL',
    line_2: 'ACME, Inc.',
    template: '1001',
    color: 'Red',
    pages: '1..3,5',
  })

File.write('watermarked.pdf', response.body) if response.status.success?
```

```go title="Go"
package main

import (
	"bytes"
	"io"
	"mime/multipart"
	"net/http"
	"os"
)

func main() {
	var buf bytes.Buffer
	form := multipart.NewWriter(&buf)

	file, _ := os.Open("input.pdf")
	defer file.Close()
	part, _ := form.CreateFormFile("file", "input.pdf")
	io.Copy(part, file)

	form.WriteField("line_1", "CONFIDENTIAL")
	form.WriteField("line_2", "ACME, Inc.")
	form.WriteField("template", "1001")
	form.WriteField("color", "Red")
	form.WriteField("pages", "1..3,5")
	form.Close()

	req, _ := http.NewRequest("POST", "https://api.pdfblocks.com/v1/add_text_watermark", &buf)
	req.Header.Set("Content-Type", form.FormDataContentType())
	req.Header.Set("X-API-Key", "your_api_key")

	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()

	out, _ := os.Create("watermarked.pdf")
	defer out.Close()
	io.Copy(out, res.Body)
}
```

```csharp title="C#"
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "your_api_key");

using var form = new MultipartFormDataContent
{
    { new ByteArrayContent(File.ReadAllBytes("input.pdf")), "file", "input.pdf" },
    { new StringContent("CONFIDENTIAL"), "line_1" },
    { new StringContent("ACME, Inc."), "line_2" },
    { new StringContent("1001"), "template" },
    { new StringContent("Red"), "color" },
    { new StringContent("1..3,5"), "pages" },
};

var response = await client.PostAsync(
    "https://api.pdfblocks.com/v1/add_text_watermark", form);
response.EnsureSuccessStatusCode();
await File.WriteAllBytesAsync(
    "watermarked.pdf", await response.Content.ReadAsByteArrayAsync());
```

</CodeGroup>

## レスポンス

成功すると、透かしを付与した PDF を本文とする `200 OK` が返されます：

```http
HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Length: 48213
```

出力は入力と同じページ数・寸法を保持し、追加されるのは透かしのみです。上記の例のように、レスポンスの本文はそのままファイルにストリーミングしてください。サーバー側には何も保存されません。

## エラー

リクエストが失敗した場合は、`application/problem+json` 形式のボディが返されます。このエンドポイントで最も多いのは `400` で、パラメーターが無効な場合や `file` が読み取り可能な PDF でない場合に返され、`errors` オブジェクトに該当するフィールド名が示されます：

```json
{
  "type": "https://www.pdfblocks.com/docs/api/v1/error/400",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "errors": {
    "line_1": ["The field line_1 must be a string with a maximum length of 32."]
  }
}
```

`X-API-Key` が指定されていないか無効な場合は `401` が返されます。すべてのステータスコードとレスポンスの完全な形式については、[エラー](/docs/api/errors)を参照してください。

## レシピ

よく使われるバリエーションです。展開すると、各言語のコード例を確認できます。

<AccordionGroup>

<Accordion title="すべてのページに太字の赤い DRAFT を付与">

<CodeGroup>

```bash title="cURL"
curl https://api.pdfblocks.com/v1/add_text_watermark \
  -H 'X-API-Key: your_api_key' \
  -F file=@input.pdf \
  -F line_1='DRAFT' \
  -F color=Red \
  -F template=1001 \
  -F transparency=40 \
  -o draft.pdf
```

```python title="Python"
import requests

with open('input.pdf', 'rb') as file:
    response = requests.post(
        'https://api.pdfblocks.com/v1/add_text_watermark',
        headers={'X-API-Key': 'your_api_key'},
        files={'file': file},
        data={'line_1': 'DRAFT', 'color': 'Red', 'template': 1001, 'transparency': 40},
    )

response.raise_for_status()
with open('draft.pdf', 'wb') as output:
    output.write(response.content)
```

```javascript title="Node.js"
import { readFile, writeFile } from 'node:fs/promises';

const body = new FormData();
body.set('file', new Blob([await readFile('input.pdf')]), 'input.pdf');
body.set('line_1', 'DRAFT');
body.set('color', 'Red');
body.set('template', '1001');
body.set('transparency', '40');

const response = await fetch('https://api.pdfblocks.com/v1/add_text_watermark', {
  method: 'POST',
  headers: { 'X-API-Key': 'your_api_key' },
  body,
});

if (!response.ok) throw new Error(`Request failed: ${response.status}`);
await writeFile('draft.pdf', Buffer.from(await response.arrayBuffer()));
```

```php title="PHP"
<?php
$ch = curl_init('https://api.pdfblocks.com/v1/add_text_watermark');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['X-API-Key: your_api_key'],
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => [
        'file' => new CURLFile('input.pdf', 'application/pdf'),
        'line_1' => 'DRAFT',
        'color' => 'Red',
        'template' => '1001',
        'transparency' => '40',
    ],
]);

$pdf = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) === 200) {
    file_put_contents('draft.pdf', $pdf);
}
```

```ruby title="Ruby"
require 'http'

response = HTTP
  .headers('X-API-Key' => 'your_api_key')
  .post('https://api.pdfblocks.com/v1/add_text_watermark', form: {
    file: HTTP::FormData::File.new('input.pdf'),
    line_1: 'DRAFT',
    color: 'Red',
    template: '1001',
    transparency: '40',
  })

File.write('draft.pdf', response.body) if response.status.success?
```

```go title="Go"
package main

import (
	"bytes"
	"io"
	"mime/multipart"
	"net/http"
	"os"
)

func main() {
	var buf bytes.Buffer
	form := multipart.NewWriter(&buf)

	file, _ := os.Open("input.pdf")
	defer file.Close()
	part, _ := form.CreateFormFile("file", "input.pdf")
	io.Copy(part, file)

	form.WriteField("line_1", "DRAFT")
	form.WriteField("color", "Red")
	form.WriteField("template", "1001")
	form.WriteField("transparency", "40")
	form.Close()

	req, _ := http.NewRequest("POST", "https://api.pdfblocks.com/v1/add_text_watermark", &buf)
	req.Header.Set("Content-Type", form.FormDataContentType())
	req.Header.Set("X-API-Key", "your_api_key")

	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()

	out, _ := os.Create("draft.pdf")
	defer out.Close()
	io.Copy(out, res.Body)
}
```

```csharp title="C#"
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "your_api_key");

using var form = new MultipartFormDataContent
{
    { new ByteArrayContent(File.ReadAllBytes("input.pdf")), "file", "input.pdf" },
    { new StringContent("DRAFT"), "line_1" },
    { new StringContent("Red"), "color" },
    { new StringContent("1001"), "template" },
    { new StringContent("40"), "transparency" },
};

var response = await client.PostAsync(
    "https://api.pdfblocks.com/v1/add_text_watermark", form);
response.EnsureSuccessStatusCode();
await File.WriteAllBytesAsync(
    "draft.pdf", await response.Content.ReadAsByteArrayAsync());
```

</CodeGroup>

</Accordion>

<Accordion title="表紙に輪郭スタイルの CONFIDENTIAL を付与">

<CodeGroup>

```bash title="cURL"
curl https://api.pdfblocks.com/v1/add_text_watermark \
  -H 'X-API-Key: your_api_key' \
  -F file=@input.pdf \
  -F line_1='CONFIDENTIAL' \
  -F template=1017 \
  -F pages='1' \
  -o confidential.pdf
```

```python title="Python"
import requests

with open('input.pdf', 'rb') as file:
    response = requests.post(
        'https://api.pdfblocks.com/v1/add_text_watermark',
        headers={'X-API-Key': 'your_api_key'},
        files={'file': file},
        data={'line_1': 'CONFIDENTIAL', 'template': 1017, 'pages': '1'},
    )

response.raise_for_status()
with open('confidential.pdf', 'wb') as output:
    output.write(response.content)
```

```javascript title="Node.js"
import { readFile, writeFile } from 'node:fs/promises';

const body = new FormData();
body.set('file', new Blob([await readFile('input.pdf')]), 'input.pdf');
body.set('line_1', 'CONFIDENTIAL');
body.set('template', '1017');
body.set('pages', '1');

const response = await fetch('https://api.pdfblocks.com/v1/add_text_watermark', {
  method: 'POST',
  headers: { 'X-API-Key': 'your_api_key' },
  body,
});

if (!response.ok) throw new Error(`Request failed: ${response.status}`);
await writeFile('confidential.pdf', Buffer.from(await response.arrayBuffer()));
```

```php title="PHP"
<?php
$ch = curl_init('https://api.pdfblocks.com/v1/add_text_watermark');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['X-API-Key: your_api_key'],
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => [
        'file' => new CURLFile('input.pdf', 'application/pdf'),
        'line_1' => 'CONFIDENTIAL',
        'template' => '1017',
        'pages' => '1',
    ],
]);

$pdf = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) === 200) {
    file_put_contents('confidential.pdf', $pdf);
}
```

```ruby title="Ruby"
require 'http'

response = HTTP
  .headers('X-API-Key' => 'your_api_key')
  .post('https://api.pdfblocks.com/v1/add_text_watermark', form: {
    file: HTTP::FormData::File.new('input.pdf'),
    line_1: 'CONFIDENTIAL',
    template: '1017',
    pages: '1',
  })

File.write('confidential.pdf', response.body) if response.status.success?
```

```go title="Go"
package main

import (
	"bytes"
	"io"
	"mime/multipart"
	"net/http"
	"os"
)

func main() {
	var buf bytes.Buffer
	form := multipart.NewWriter(&buf)

	file, _ := os.Open("input.pdf")
	defer file.Close()
	part, _ := form.CreateFormFile("file", "input.pdf")
	io.Copy(part, file)

	form.WriteField("line_1", "CONFIDENTIAL")
	form.WriteField("template", "1017")
	form.WriteField("pages", "1")
	form.Close()

	req, _ := http.NewRequest("POST", "https://api.pdfblocks.com/v1/add_text_watermark", &buf)
	req.Header.Set("Content-Type", form.FormDataContentType())
	req.Header.Set("X-API-Key", "your_api_key")

	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()

	out, _ := os.Create("confidential.pdf")
	defer out.Close()
	io.Copy(out, res.Body)
}
```

```csharp title="C#"
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "your_api_key");

using var form = new MultipartFormDataContent
{
    { new ByteArrayContent(File.ReadAllBytes("input.pdf")), "file", "input.pdf" },
    { new StringContent("CONFIDENTIAL"), "line_1" },
    { new StringContent("1017"), "template" },
    { new StringContent("1"), "pages" },
};

var response = await client.PostAsync(
    "https://api.pdfblocks.com/v1/add_text_watermark", form);
response.EnsureSuccessStatusCode();
await File.WriteAllBytesAsync(
    "confidential.pdf", await response.Content.ReadAsByteArrayAsync());
```

</CodeGroup>

</Accordion>

<Accordion title="最後のページを除くすべてのページに控えめなグレーの通知を付与">

<CodeGroup>

```bash title="cURL"
curl https://api.pdfblocks.com/v1/add_text_watermark \
  -H 'X-API-Key: your_api_key' \
  -F file=@input.pdf \
  -F line_1='ACME, Inc.' \
  -F line_2='Do not distribute' \
  -F color=Gray \
  -F transparency=88 \
  -F pages='..-2' \
  -o notice.pdf
```

```python title="Python"
import requests

with open('input.pdf', 'rb') as file:
    response = requests.post(
        'https://api.pdfblocks.com/v1/add_text_watermark',
        headers={'X-API-Key': 'your_api_key'},
        files={'file': file},
        data={
            'line_1': 'ACME, Inc.',
            'line_2': 'Do not distribute',
            'color': 'Gray',
            'transparency': 88,
            'pages': '..-2',
        },
    )

response.raise_for_status()
with open('notice.pdf', 'wb') as output:
    output.write(response.content)
```

```javascript title="Node.js"
import { readFile, writeFile } from 'node:fs/promises';

const body = new FormData();
body.set('file', new Blob([await readFile('input.pdf')]), 'input.pdf');
body.set('line_1', 'ACME, Inc.');
body.set('line_2', 'Do not distribute');
body.set('color', 'Gray');
body.set('transparency', '88');
body.set('pages', '..-2');

const response = await fetch('https://api.pdfblocks.com/v1/add_text_watermark', {
  method: 'POST',
  headers: { 'X-API-Key': 'your_api_key' },
  body,
});

if (!response.ok) throw new Error(`Request failed: ${response.status}`);
await writeFile('notice.pdf', Buffer.from(await response.arrayBuffer()));
```

```php title="PHP"
<?php
$ch = curl_init('https://api.pdfblocks.com/v1/add_text_watermark');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['X-API-Key: your_api_key'],
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => [
        'file' => new CURLFile('input.pdf', 'application/pdf'),
        'line_1' => 'ACME, Inc.',
        'line_2' => 'Do not distribute',
        'color' => 'Gray',
        'transparency' => '88',
        'pages' => '..-2',
    ],
]);

$pdf = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) === 200) {
    file_put_contents('notice.pdf', $pdf);
}
```

```ruby title="Ruby"
require 'http'

response = HTTP
  .headers('X-API-Key' => 'your_api_key')
  .post('https://api.pdfblocks.com/v1/add_text_watermark', form: {
    file: HTTP::FormData::File.new('input.pdf'),
    line_1: 'ACME, Inc.',
    line_2: 'Do not distribute',
    color: 'Gray',
    transparency: '88',
    pages: '..-2',
  })

File.write('notice.pdf', response.body) if response.status.success?
```

```go title="Go"
package main

import (
	"bytes"
	"io"
	"mime/multipart"
	"net/http"
	"os"
)

func main() {
	var buf bytes.Buffer
	form := multipart.NewWriter(&buf)

	file, _ := os.Open("input.pdf")
	defer file.Close()
	part, _ := form.CreateFormFile("file", "input.pdf")
	io.Copy(part, file)

	form.WriteField("line_1", "ACME, Inc.")
	form.WriteField("line_2", "Do not distribute")
	form.WriteField("color", "Gray")
	form.WriteField("transparency", "88")
	form.WriteField("pages", "..-2")
	form.Close()

	req, _ := http.NewRequest("POST", "https://api.pdfblocks.com/v1/add_text_watermark", &buf)
	req.Header.Set("Content-Type", form.FormDataContentType())
	req.Header.Set("X-API-Key", "your_api_key")

	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()

	out, _ := os.Create("notice.pdf")
	defer out.Close()
	io.Copy(out, res.Body)
}
```

```csharp title="C#"
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "your_api_key");

using var form = new MultipartFormDataContent
{
    { new ByteArrayContent(File.ReadAllBytes("input.pdf")), "file", "input.pdf" },
    { new StringContent("ACME, Inc."), "line_1" },
    { new StringContent("Do not distribute"), "line_2" },
    { new StringContent("Gray"), "color" },
    { new StringContent("88"), "transparency" },
    { new StringContent("..-2"), "pages" },
};

var response = await client.PostAsync(
    "https://api.pdfblocks.com/v1/add_text_watermark", form);
response.EnsureSuccessStatusCode();
await File.WriteAllBytesAsync(
    "notice.pdf", await response.Content.ReadAsByteArrayAsync());
```

</CodeGroup>

</Accordion>

</AccordionGroup>

## 関連アクション

<CardGroup cols={2}>

<Card title="画像透かしの追加" href="/docs/api/add-image-watermark-to-pdf">
  テキストの代わりにロゴや画像を付与します。
</Card>

<Card title="パスワードを追加" href="/docs/api/add-password-to-pdf">
  透かしを付与したドキュメントを暗号化します。
</Card>

<Card title="ドキュメントの結合" href="/docs/api/merge-pdf-documents">
  透かしを付与する前にファイルを結合します。
</Card>

<Card title="制限を追加" href="/docs/api/add-restrictions-to-pdf">
  印刷、コピー、編集を制限します。
</Card>

</CardGroup>
