本文へスキップ

PDFをサニタイズ

JavaScript・埋め込みファイル・開いた瞬間に動くアクションを取り除きます。

お使いの端末で処理

このツールはブラウザーの中だけで動きます。ファイルがアップロードされることはなく、そのことはブラウザーのネットワークタブでご自身で確認できます。 ご自分で確かめてください。ブラウザーのネットワークタブを開いて見てください。残りの作業回数を尋ねる小さなリクエストが1つだけ表示されます。ツール名とハッシュだけで、ファイルは決して含まれません。

このツールでできること

A PDF is not a static document. It can carry JavaScript, run an action the moment it is opened, hold other files inside itself, and send a reader out to a URL. Those features have legitimate uses, and they are also why PDFs are a common malware carrier. This tool rebuilds the document from its pages alone, which leaves every document-level hook behind.

Use it on anything that arrived unexpectedly and has to be read anyway: an invoice from an address you do not recognise, a CV from a job board, a form downloaded from a site you have no reason to trust. It is also worth running on files you distribute, so nobody has to wonder whether the attachment inside yours is meant to be there.

仕組み

  1. Drop the PDF onto this page.
  2. Leave the three main switches on. JavaScript, embedded files and open actions are all served by one rebuild, and together they cover nearly everything active a PDF can carry.
  3. Turn on Remove external links if the file came from a source you do not trust, since a link is a phishing vector even when nothing else in the file is.
  4. Turn on Strip metadata under advanced options if you also want the author and timestamps gone.
  5. Press Sanitize. The result reports the page count and how many embedded files were removed.

The removal works by not copying rather than by deleting. The document is rebuilt into an empty file with only its pages carried over, so document-level JavaScript, the name tree of embedded files, the action that fires on open and the rest are never brought across at all. That is more reliable than hunting through a file for each hook: you cannot forget to remove something you never copied.

Because it is one rebuild, the first three switches are effectively one decision. Turning any of them on rebuilds the document, and the rebuild leaves all of them behind. They are separate controls because they name separate worries, not because you can keep the JavaScript and lose the attachments.

The rebuild is thorough enough to cost you things you may want. Document-level structure is exactly what is discarded, so the interactive form dictionary, the outline and anything else attached to the document rather than to a page does not survive. A fillable form comes out as pages that look right and no longer fill in. That is why you should sanitise files you receive rather than files you are still working on.

A file attached as a page annotation is not in the name tree, so the rebuild alone would leave it in place. Attachments are counted before the rebuild and removed by name afterwards, which catches both kinds. The number in the result is what was actually found, so a report of zero embedded files is information rather than a shrug.

This runs entirely in your browser on qpdf compiled to WebAssembly. For a file you already suspect, that is the right shape: the document is never handed to a third party, and it is never opened by a full PDF reader with scripting enabled - qpdf parses the structure without executing anything in it.

このツールにできないこと

  • This is not antivirus software. It removes the categories of active content a PDF can hold; it does not scan for or identify malware, and it cannot tell you whether a file was hostile.
  • The rebuild discards document-level structure, so a fillable form stops being fillable and the outline is not carried over.

よくある質問

PDFのアクティブなコンテンツとは何ですか?
リーダーが自動で実行することのあるドキュメントレベルのJavaScript、ファイルを開いた瞬間に動くOpenAction(およびページ切り替えやフォーム操作で動く同種のトリガー)、PDFの中に埋め込まれたファイル、そしてURLへアクセスするリンクやアクションです。どれも正当な機能ですが、同時にPDFが攻撃の運び手として使われるときの定番の入口でもあります。
これでPDFのウイルスを駆除できますか?
ウイルスを運んだり起動したりできる部分を取り除くだけで、マルウェアを検査するのとは違いますし、そう扱うべきではありません。本当に悪意があると思う理由があるなら、開かないでください。ウイルス対策ソフトを使うか、信頼できる別の手段で送信者に確認してください。サニタイズはドキュメントにできることを減らすもので、安全だという判定ではありません。
そのあと動かなくなるものは何ですか?
ページではなくドキュメントに依存するものすべてです。入力フォームは入力を受け付けなくなり、しおりは引き継がれず、埋め込みの添付ファイルはなくなり、JavaScriptで合計を計算していたフォームは最後に保存された値しか表示しなくなります。ページの内容・テキスト・画像は変わりません。
外部リンクも削除したほうがいいですか?
既定ではオフです。たいていのドキュメントではリンクは必要なものですし、自分で読むレポートからリンクを消すのは不便だからです。信頼できない相手から届いたファイルではオンにしてください。見慣れた銀行のように見えて別の場所を指すリンクはもっとも古い手口で、リンクをすべて消すのは乱暴ですが確実な対処です。
怪しいファイルはどこかにアップロードされますか?
いいえ。qpdfはブラウザーのWeb Worker上でWebAssemblyとして動き、中身を実行することなくファイルの構造だけを解析します。すでに疑っているファイルがサーバーに届くことはありませんし、その途中でスクリプトを実行できるリーダーに渡されることもありません。

関連ツール