PDF Blocks
料金サポート
無料で始める
ページへ移動

PDF から署名を削除する

PDF ドキュメントから暗号学的な署名とタイムスタンプを削除します。

PDF ドキュメントから暗号学的な署名とタイムスタンプを削除します。電子署名はドキュメントを封印し、誰が署名したか、そしてそれ以降内容が変更されていないことを証明します。そのため、結合や透かしの付与、ページ番号の振り直しなど、それ以降の編集はこの封印を破り、署名を無効にしてしまいます。先に署名とタイムスタンプを削除しておけば、署名済みドキュメントをクリーンに再処理できます。ページの内容はそのまま残ります。この API はステートレスです。ドキュメントはリージョン内で処理され、保存されることはありません。

エンドポイント

POST
/v1/remove_signatures

すべてのリージョンで利用できます。ルーティングとデータレジデンシーについては、リージョンとデータレジデンシーを参照してください。

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

認証

すべてのリクエストは、X-API-Key ヘッダーにシークレット API キーを設定し、HTTPS 経由で認証してください。キーの作成と管理はダッシュボードから行えます。詳細は認証を参照してください。

リクエスト

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

filefilerequired

入力 PDF ドキュメントです。

署名済み PDF から署名とタイムスタンプを削除します。

cURLbash
curl https://api.pdfblocks.com/v1/remove_signatures \
  -H 'X-API-Key: your_api_key' \
  -F file=@input.pdf \
  -o unsigned.pdf
Pythonpython
# pip install requests
import requests

with open('input.pdf', 'rb') as file:
    response = requests.post(
        'https://api.pdfblocks.com/v1/remove_signatures',
        headers={'X-API-Key': 'your_api_key'},
        files={'file': file},
    )

response.raise_for_status()
with open('unsigned.pdf', 'wb') as output:
    output.write(response.content)
Node.jsjavascript
// 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');

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

if (!response.ok) throw new Error(`Request failed: ${response.status}`);
await writeFile('unsigned.pdf', Buffer.from(await response.arrayBuffer()));
PHPphp
<?php
$ch = curl_init('https://api.pdfblocks.com/v1/remove_signatures');
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'),
    ],
]);

$pdf = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) === 200) {
    file_put_contents('unsigned.pdf', $pdf);
}
Rubyruby
# gem install http
require 'http'

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

File.write('unsigned.pdf', response.body) if response.status.success?
Gogo
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.Close()

	req, _ := http.NewRequest("POST", "https://api.pdfblocks.com/v1/remove_signatures", &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("unsigned.pdf")
	defer out.Close()
	io.Copy(out, res.Body)
}
C#csharp
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" },
};

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

レスポンス

成功すると、レスポンスは 200 OK となり、ボディに PDF が入ります。

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

出力は、すべての署名とタイムスタンプが削除された同一のドキュメントです。ページと内容は変更されません。上記の例のように、ボディを直接ファイルへストリーミングしてください。当社側には何も保存されません。

エラー

失敗したリクエストは application/problem+json 形式のボディを返します。このエンドポイントで最も多いのは 400 で、file が読み取り可能な PDF でない場合に返されます。errors オブジェクトには、フィールドごとの内容が示されます。

{
  "type": "https://www.pdfblocks.com/docs/api/v1/error/400",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "errors": {
    "file": ["Could not parse the PDF document. The file may be invalid or corrupt."]
  }
}

X-API-Key が存在しないか無効な場合は 401 が返されます。ステータスコードとレスポンスの完全な形式については、エラーを参照してください。

関連アクション