PDFの文章を比べるには
この記事のポイント
- 使う
2つのPDFの文章を比べたいとき、PDFからコピーした文章を、2つの文章の違いを調べる に貼り付けて比べる方法があります。専用のPDF比較ツールが使えない場合の、別の方法です。
手順
- PDFから、文字を取り出します(PDFビューアでコピー、またはPDFから文字を抜き出すツール)。
- 1つ目のPDFの文章を、「文章A(前)」に貼り付けます。
- 2つ目のPDFの文章を、「文章B(後)」に貼り付けます。
- 「比べる」を押して、「違いを見る」を確認します。
スキャンしたPDFは、文字が画像のため、そのままでは取り出せません。先に、OCRで文字にします。
専用の比較ツールとの使い分け
- PDFの比較ツール:2つのPDFを選ぶだけで、比べられる。手軽。
- このツール:取り出した文章を、自分で整えてから比べたい場合に便利。
このツールで比べるメリット
- 比べる前に、文章を整えられる(不要なヘッダーやページ番号を、消すなど)
- 大文字・小文字や、前後の空白を無視するオプションが使える
- 一部の章だけを、取り出して比べられる
取り出した文章を整えるコツ
- ページ番号や、ヘッダー・フッターを、削除する
- 改行が多すぎるときは、改行を整えるツールを使う
- 比べたい章だけを、取り出す
注意すること
- PDFから取り出した文章は、改行の位置が、元と違う場合がある。
- 表や図の内容は、文字として取り出せない場合がある。
- 3000行までです。長いPDFは、分けて比べる。
向いている場面
- 契約書の、改訂前後の比較
- 規約や、マニュアルの、バージョン違いの確認
- 論文の、修正前後の比較
例
2つのバージョンの規約PDFを比べたかった。両方から本文を取り出して、ページ番号を削除してから貼り付けた。変更された条項だけが、表示された。
つまずきやすい点
- 全体が違うと出る:改行の位置が違う。改行を整えてから比べる。
- 文字化けする:PDFのフォントの問題。別の方法で取り出す。
よくある質問
スキャンしたPDFは比べられますか?
OCRで文字にしてから、貼り付けます。
まとめ
PDFの文章を取り出して整え、貼り付けて比べる。専用ツールと使い分けましょう。
2つの文章の違いを調べるを使う(無料)あわせて使えるツール
- 2つのPDFの違いを比べる(差分チェック):2つのPDFの文字の違いを、色分けして表示します。
- 重複した行を消す・並べ替える:重複した行を消して、並べ替えます。
- 文字数カウント(エントリーシート・レポート用):文章の文字数・行数・原稿用紙の枚数などを数えます。
同じツールの、ほかの解説
Comparing Text from PDFs
Key points
- Use
When you want to compare the text of two PDFs, one method is to paste text copied from the PDFs into Compare Two Texts (Diff) and compare. It's an alternative when the dedicated PDF comparison tool can't be used.
Steps
- Extract text from the PDFs (copy in a PDF viewer, or use the tool that extracts text from PDFs).
- Paste the first PDF's text into "Text A (before)".
- Paste the second PDF's text into "Text B (after)".
- Press "Compare" and check "See the differences".
In a scanned PDF the text is an image and can't be extracted as it is. Turn it into text with OCR first.
Choosing between the dedicated comparison tool and this one
- The PDF comparison tool: just choose two PDFs to compare. Easy.
- This tool: handy when you want to tidy the extracted text yourself before comparing.
Benefits of comparing with this tool
- You can tidy the text before comparing (such as removing unneeded headers and page numbers)
- You can use the options to ignore case and surrounding spaces
- You can extract and compare only certain chapters
Tips for tidying extracted text
- Delete page numbers and headers/footers
- When there are too many line breaks, use the line-break tidying tool
- Extract only the chapters you want to compare
Cautions
- Text extracted from a PDF may have line-break positions different from the original.
- Content of tables and figures may not be extractable as text.
- Up to 3000 lines. Compare long PDFs in parts.
Good for
- Comparing a contract before and after revision
- Checking version differences in terms or manuals
- Comparing a paper before and after revision
Example
Wanted to compare two versions of a terms PDF. Extracted the body text from both and pasted it after deleting page numbers. Only the changed clauses were shown.
Common stumbling blocks
- Everything shows as different: line-break positions differ. Tidy line breaks before comparing.
- Text is garbled: a PDF font problem. Extract another way.
Frequently asked questions
Can scanned PDFs be compared?
Turn them into text with OCR and then paste.
Summary
Extract the PDF text, tidy it, paste and compare. Use alongside the dedicated tool.
Use "Compare Two Texts (Diff)" (free)Tools that go well with this
- Compare Two PDFs (Find Differences): Show the text differences between two PDFs, color-coded.
- Remove Duplicate Lines and Sort a List: Remove duplicate lines and sort them.
- Character Counter (for Applications and Reports): Count characters, lines and manuscript sheets of your text.