Nano PDF Skill - 自然言語指示によるPDF編集を実現するClawdbot拡張機能
Clawdbot向けNano PDF Skillを利用して、自然言語指示によるPDFファイルの編集(テキスト変更、誤字修正、レイアウト調整)をコマンドラインから実現する方法を解説します。
Nano PDF Skill - 自然言語指示によるPDF編集を実現するClawdbot拡張機能
Clawdbot向けのNano PDF Skillが提供するnano-pdfコマンドにより、PDFファイルの特定ページに対して自然言語指示でテキスト編集を実行できる。本スキルは、タイトル変更、誤字修正、レイアウト調整などの編集操作を、Adobe AcrobatやPDF編集ソフトを使わずにコマンドラインから実現する。
概要
Nano PDF Skillは、PDFファイルの編集をプログラマティックに実行するためのツールである。Clawdbotのスキルシステムに統合されており、AIエージェントが「このPDFの1ページ目のタイトルを変更して」といった自然言語指示を受け取り、自動的にPDF編集を実行できる仕組みを提供する。
公式パッケージリポジトリ(https://pypi.org/project/nano-pdf/)によれば、本ツールはPython製であり、uvパッケージマネージャーを通じてインストールされる設計となっている。
技術的仕様
システム要件
- Python 3.8以降
- uvパッケージマネージャー
nano-pdfパッケージ(PyPI経由でインストール)
インストール方法
Clawdbot環境では、以下のコマンドでインストールが実行される。
uv tool install nano-pdf
インストール後、nano-pdfコマンドがシステムPATHに追加される。
ページ番号の仕様
ツールのバージョンまたは設定により、ページ番号が0ベース(0から開始)または1ベース(1から開始)となる場合がある。期待した結果が得られない場合は、別のページ番号で再試行することが推奨される。
主要機能
1. 基本的なテキスト編集
指定ページのテキストを自然言語指示で変更する。
nano-pdf edit deck.pdf 1 "Change the title to 'Q3 Results' and fix the typo in the subtitle"
構文:
nano-pdf edit <input-file> <page-number> "<instruction>"
2. 複数箇所の同時編集
1つの指示で複数の編集操作を実行できる。
nano-pdf edit report.pdf 3 "Update the date to February 15, 2026, change 'Q4 2025' to 'Q1 2026', and correct the spelling of 'accommodate'"
3. 出力ファイル指定
編集結果を別ファイルに保存する(元ファイルを保持)。
nano-pdf edit input.pdf 1 "Change title" --output output.pdf
実装例
例1: プレゼンテーション資料のタイトルページ更新
#!/bin/bash
# Q3レポートのタイトルページを更新
nano-pdf edit "Q3_Report_Draft.pdf" 1 "Change the main title to 'Q3 2026 Financial Results' and update the subtitle from 'Preliminary Draft' to 'Final Version'"
echo "Title page updated successfully"
例2: 誤字の一括修正
#!/bin/bash
# 複数ページの誤字を修正
pages=(2 5 8 12)
for page in "${pages[@]}"; do
nano-pdf edit "document.pdf" "$page" "Fix all occurrences of 'teh' to 'the' and 'recieve' to 'receive'"
done
echo "Typos fixed on pages: ${pages[*]}"
例3: バッチ処理によるPDFカタログ更新
#!/bin/bash
# 製品カタログの価格情報を一括更新
products=("product_A.pdf" "product_B.pdf" "product_C.pdf")
new_price="$299.99"
for product in "${products[@]}"; do
nano-pdf edit "$product" 1 "Update the price to $new_price and add 'Limited Time Offer' below the price"
echo "Updated: $product"
done
例4: Node.js統合による動的PDF生成パイプライン
const { exec } = require('child_process');
const util = require('util');
const execPromise = util.promisify(exec);
async function editPDF(inputFile, pageNumber, instruction, outputFile = null) {
let command = `nano-pdf edit "${inputFile}" ${pageNumber} "${instruction}"`;
if (outputFile) {
command += ` --output "${outputFile}"`;
}
try {
const { stdout, stderr } = await execPromise(command);
console.log('PDF edited successfully');
return { success: true, stdout, stderr };
} catch (error) {
console.error(`Error editing PDF: ${error.message}`);
return { success: false, error: error.message };
}
}
// 使用例
(async () => {
await editPDF(
'report.pdf',
1,
"Change the title to 'Annual Report 2026' and add 'Confidential' watermark",
'report_updated.pdf'
);
})();
例5: Gitワークフローへの統合
#!/bin/bash
# Git pre-commitフックでPDFドキュメントのバージョン番号を自動更新
VERSION=$(git describe --tags --always)
DATE=$(date +"%Y-%m-%d")
nano-pdf edit "documentation.pdf" 1 "Update version number to $VERSION and date to $DATE"
git add documentation.pdf
echo "PDF documentation updated with version $VERSION"
ユースケース
1. AIエージェントによる自動ドキュメント更新
Clawdbotエージェントが定期的にPDFレポートの日付、バージョン番号、統計データを自動更新する環境を構築できる。
2. 大量PDFの一括編集
企業の製品カタログや価格表など、数百のPDFファイルに対して同一の編集操作(価格改定、連絡先変更など)を効率的に実行できる。
3. CIパイプラインでのPDF生成
GitLabやGitHub ActionsなどのCI/CD環境で、LaTeXやMarkdownから生成されたPDFに対してメタデータやバージョン情報を自動追加できる。
4. プレゼンテーション資料の迅速な修正
会議直前にスライドの誤字やデータを修正する際、Adobe Acrobatを開かずにコマンドラインから即座に対応できる。
5. 法務・コンプライアンス文書の更新
契約書テンプレートや利用規約PDFの特定条項を自動的に更新し、バージョン管理下で履歴を保持できる。
制限事項・セキュリティ考慮事項
制限事項
- ページ単位の編集: 複数ページにまたがる編集を1コマンドで実行できない(ループ処理が必要)
- レイアウト制限: 複雑なグラフィックや画像が含まれるページでは、テキスト編集が正確に反映されない可能性がある
- フォント依存: 元のPDFで使用されているフォントが編集環境にない場合、フォントが置き換えられる可能性がある
- 暗号化PDF: パスワード保護されたPDFは事前に解除する必要がある
- ページ番号の曖昧性: 0ベースまたは1ベースの番号体系がバージョンにより異なるため、期待したページが編集されない場合がある
セキュリティ考慮事項
-
元ファイルの保護:
nano-pdfはデフォルトで元ファイルを上書きする可能性があるため、編集前にバックアップを作成することを推奨cp original.pdf original_backup.pdf nano-pdf edit original.pdf 1 "Edit instruction" -
機密情報の検証: 編集後のPDFに意図しない情報が残っていないか、目視確認が必要
- 例: 削除したはずのテキストがメタデータに残存
-
インジェクション攻撃: ユーザー入力を自然言語指示にそのまま渡す場合、コマンドインジェクションのリスクがある
# 危険な例(ユーザー入力をサニタイズせずに使用) user_input = input("Enter edit instruction: ") os.system(f'nano-pdf edit file.pdf 1 "{user_input}"') # 安全な例(入力検証) import shlex user_input = shlex.quote(input("Enter edit instruction: ")) os.system(f'nano-pdf edit file.pdf 1 {user_input}') -
出力ファイルの権限: 編集されたPDFファイルのパーミッションを適切に設定
nano-pdf edit input.pdf 1 "Edit instruction" --output output.pdf chmod 600 output.pdf # 所有者のみ読み書き可能 -
バージョン管理: 編集履歴を追跡するため、Git LFSなどでPDFファイルをバージョン管理することを推奨
参考リンク
- Nano PDF PyPIページ: https://pypi.org/project/nano-pdf/
- uv公式サイト: https://github.com/astral-sh/uv
- Python公式サイト: https://www.python.org/
- PDF 1.7仕様(ISO 32000-1): https://www.iso.org/standard/51502.html
- Clawdbot公式サイト: https://clawdbot.io/
本記事の情報は2026年2月15日時点のものです。Nano PDF Skillの機能、コマンド仕様、インストール方法は変更される可能性があります。最新情報は公式PyPIページおよびドキュメントをご確認ください。
Related Articles
OpenClaw Skills Ranking February 2026: Planning Skills and Security Suite Dominate Top 10
GitHub OpenClaw skills ranking shows awesome-openclaw-skills (16,139 stars), Manus-style planning implementation planning-with-files (14,000 stars), and Obsidian integration (9,998 stars) claiming top 3 positions.
OpenClaw v2026.2.17: Claude Sonnet 4.6 Support, 1M Context, Slack/Telegram Enhancements
OpenClaw releases major update with Claude Sonnet 4.6 and 1M context window support, Slack native streaming, Telegram inline button styles, iOS Share Extension, and critical security fixes (OC-09) among 100+ changes.
Cursor CLI Update: Plan Handoff to Cloud, Mermaid ASCII Diagrams, and Quality-of-Life Improvements
Cursor updates its CLI with plan-to-cloud handoff from the terminal, inline ASCII rendering of Mermaid diagrams, and a range of tooling and reliability improvements.
Popular Articles
Claude Code v2.1.93 Released - Deferred Permission Decisions, Flicker-Free Rendering, and More
Anthropic releases Claude Code v2.1.93 with deferred permission decisions for PreToolUse hooks, flicker-free rendering option, PermissionDenied hook, and named subagent typeahead support.
Claude Code v2.1.92 Released - forceRemoteSettingsRefresh, Bedrock Setup Wizard, and More
Anthropic releases Claude Code v2.1.92 with forceRemoteSettingsRefresh policy setting, AWS Bedrock setup wizard, /cost command improvements, and numerous bug fixes.
Claude Code v2.1.84 Release - PowerShell Tool Preview and Environment Configuration Enhancements
Claude Code v2.1.84 introduces PowerShell tool for Windows, new environment variable overrides for model selection, idle session handling improvements, and various stability fixes.
Latest Articles
Claude Code v2.1.93 Released - Deferred Permission Decisions, Flicker-Free Rendering, and More
Anthropic releases Claude Code v2.1.93 with deferred permission decisions for PreToolUse hooks, flicker-free rendering option, PermissionDenied hook, and named subagent typeahead support.
Claude Code v2.1.92 Released - forceRemoteSettingsRefresh, Bedrock Setup Wizard, and More
Anthropic releases Claude Code v2.1.92 with forceRemoteSettingsRefresh policy setting, AWS Bedrock setup wizard, /cost command improvements, and numerous bug fixes.
Claude Code v2.1.91 Released - MCP Tool Result Persistence and Improved Edit Tool
Claude Code v2.1.91 introduces MCP tool result persistence override, improved shell execution controls, and enhanced Edit tool efficiency.