PDF を Markdown に変換
PDF を Markdown にします。見出し・リスト・表も復元します。
このツールはブラウザーの中だけで動きます。ファイルがアップロードされることはなく、そのことはブラウザーのネットワークタブでご自身で確認できます。 ご自分で確かめてください。ブラウザーのネットワークタブを開いて見てください。残りの作業回数を尋ねる小さなリクエストが1つだけ表示されます。ツール名とハッシュだけで、ファイルは決して含まれません。
このツールでできること
This reads a PDF's text and writes it out as Markdown, working out which lines are headings, where paragraphs begin and end, and which blocks are lists or tables. A PDF stores none of that - only characters at coordinates - so the structure is inferred from geometry, except where the document has a bookmark outline, which is used instead because it is the author's own account of the structure. The result is one .md file that re-flows; it does not reproduce the original pagination or layout.
Reach for it when a document has to become editable text again: a report going into a wiki, documentation that arrived as a PDF and now needs to live in a repository beside the code, or notes you would rather search and rewrite than scroll through.
仕組み
- Drop the PDF onto this page. The first five pages are checked for a text layer, so a scan is caught before you download an empty file.
- Leave Use the bookmark outline on when the document has one. A real outline is more reliable than any guess made from type size.
- Choose what else to detect: headings where no bookmark covers them, lists, and tables written as Markdown pipe tables.
- Under advanced options, add a front matter block if the file is headed for a static site, and set a page range if you only want part of the document.
- Press Convert to Markdown. The .md file downloads on its own.
A line becomes a heading when it is set larger than the body text around it, is short, and is followed by prose - three conditions rather than one, because any of them alone promotes running heads and figure captions by mistake. Bookmarks override the lot, which is why a document with a proper outline converts noticeably better than one without.
Paragraphs are rebuilt by asking why each line ended. A line that runs to the right edge of its column was broken by the typesetter, so the next line is joined onto it; a line that stops short ended on purpose, so a new paragraph starts. Hyphens at a line end are rejoined only when the continuation begins with a lowercase letter, which is what stops Coca- and Cola being welded into a word that was never in the document.
Tables are the least certain part of the conversion. Column boundaries are found by clustering the horizontal positions of text runs, so a real table converts cleanly while a two-column page layout can occasionally be read as one.
Extraction runs through PDF.js in a Web Worker inside your browser. What would be uploaded here is the document's text, which is usually the confidential part. Nothing about the text is sent, and the one request a run makes asks whether you have tasks left - a tool name and a hash of the bytes.
このツールにできないこと
- Images are not extracted. The output is text and structure only; if you want the pages as pictures, PDF to image is the tool for that.
- Layout is not preserved. Columns, text boxes and absolute positioning collapse into a single reading order, which is what Markdown is for and what makes it re-flow.
よくある質問
- 見出しはどうやって判定していますか?
- PDF にブックマークのアウトラインがあれば、それがそのまま見出しになり、階層の深さが見出しレベルになるので、推測は入りません。アウトラインがない場合は、周囲の本文より大きく、短く、そのあとに普通の文が続く行を見出しに昇格させます。どちらの判定にも個別の切り替えがあります。
- 表も変換されますか?
- はい。列の判定に十分な確信が持てたときに、Markdown のパイプ表として書き出します。テキストの左右両端から位置をクラスタリングするため、右揃えの数値列も左揃えの列と同じように見つかります。数値を表計算に入れたいのであれば、PDF を CSV に変換するほうが適しています。
- 文書の中の画像はどうなりますか?
- 取り込まれません。Markdown は画像を含まずに参照するだけなので、持ち越すには .md と並べて画像のフォルダを書き出す必要があります。この変換は、そのかわりに単体で完結する 1 つのテキストファイルを作ります。
- PDF がスキャンで、何も出てきません。なぜですか?
- スキャンしたページは文字の写真です。変換ツールが読み取れる文字が存在しないため、空の文書を書き出すかわりに、説明を出して処理を止めます。先に「PDF を OCR 処理」を実行してから変換してください。
- 変換のために文書はアップロードされますか?
- いいえ。テキストの抽出も Markdown の書き出しもブラウザ内で行われ、どの時点でも外部への通信は発生しません。信じていただく必要はなく、確かめられます。変換中にネットワークタブを見るか、接続を完全に切ったまま変換してみてください。