PDFから取り出した文字が文字化けするときの対処法
この記事のポイント
- フォントの埋め込み方によって、取り出せないことがある
- 見た目は正しくても、文字データが別のコードのことがある
- 元のファイルから、PDFを作り直すと解決することが多い
PDFの文字を取り出したら、読めない記号や、違う文字になった。これは、PDFの作り方に原因があります。
原因
- フォントの情報が特殊な形で埋め込まれていて、文字データと見た目の文字が対応していない
- PDFを作るソフトが、文字を図形(アウトライン)に変換している
- 古い形式や、特殊な日本語フォントが使われている
対処法
- 元のファイル(Wordなど)が手元にあれば、PDFを作り直す。
- 別のPDFビューアー(ブラウザ、プレビューなど)で開き、文字をコピーして試す。
- どうしても取り出せないときは、PDFを画像にして、文字認識(OCR)を使う方法があります。(このツールにはOCRはありません。)
確認
一部だけ化けているのか、全部なのかを見ます。一部なら、その部分だけ手で直す方法もあります。
PDFから文字を抜き出すを使う(無料)あわせて使えるツール
- PDFを画像に変換:PDFの各ページを、JPEGまたはPNGの画像として保存します。
- PDFのページを抜き出し・削除:PDFから、必要なページだけを残す、または不要なページを消します。
- PDFを圧縮:PDFを、指定したサイズ以下に小さくします。提出先の容量制限に合わせたいときに。
この解説が役に立ったら、応援してもらえるとうれしいです。
応援する(300円)同じツールの、ほかの解説
What to Do When Extracted PDF Text Is Garbled
Key points
- Depending on how fonts are embedded, extraction can fail
- The text data can differ from what's displayed
- Remaking the PDF from the original often solves it
After extraction, the text shows unreadable symbols or wrong characters. The cause lies in how the PDF was made.
Causes
- Font information is embedded in a special way, so text data doesn't match the displayed characters
- The software that made the PDF converted text to shapes (outlines)
- An old format or special Japanese font is used
What to do
- If you have the original file (such as Word), remake the PDF.
- Open it in another PDF viewer (a browser, Preview and so on) and try copying text there.
- If you still can't extract it, turn the PDF into images and use OCR. (This tool has no OCR.)
Checking
See whether only part is garbled or all of it. If only part, fixing it by hand may work.
Use "Extract Text from PDF" (free)Tools that go well with this
- PDF to Images: Save each page of a PDF as a JPEG or PNG image.
- Extract or Delete PDF Pages: Keep only the pages you need, or remove the pages you don't.
- Compress PDF: Shrink a PDF to fit under a size you choose, for upload limits.
If this guide helped, a small tip would mean a lot.
Send a tip (¥300)