テキストをPDFに変換
.txt・.log・.csvを、PDFのリストとして組みます。
このツールはブラウザーの中だけで動きます。ファイルがアップロードされることはなく、そのことはブラウザーのネットワークタブでご自身で確認できます。 ご自分で確かめてください。ブラウザーのネットワークタブを開いて見てください。残りの作業回数を尋ねる小さなリクエストが1つだけ表示されます。ツール名とハッシュだけで、ファイルは決して含まれません。
このツールでできること
This sets a plain text file as a PDF, one line of the file to one line of the page. The defaults are those of a code listing rather than a letter - monospace, 10 pt, wrapping on - because almost nobody converts prose this way. People convert a log, a configuration file, a CSV or a source file, usually because something else insists on receiving it as an attachment or a printout.
Reach for it when a text file has to travel as a document: a log going onto a support ticket, a configuration file that has to sit in a change record, a CSV a colleague wants to read rather than open in a spreadsheet, or a source file heading for someone with nothing to open it in.
仕組み
- Drop your .txt, .log, .csv or .md files onto this page. Up to 50 at a time, each up to 50 MB.
- Choose the typeface. Monospace is the default and is what keeps the columns of a log or a CSV lined up; sans and serif are there for the rare file that is actually prose.
- Set the type size and line spacing. 10 pt is the default; 8 pt fits noticeably more on a sheet and is worth it for a long log.
- Decide about long lines. Wrapping folds anything wider than the column so it stays visible; with wrapping off, an over-long line is clipped at the page edge instead, which is the honest rendering of a file whose lines are meant to be lines.
- Turn on line numbers if you expect to refer to a particular line, then press Convert.
- Each file downloads as its own PDF.
Wrapping is the one option that changes what the document means, which is why it is offered rather than decided for you. A folded long line stays readable but stops being one line, and anyone counting lines or diffing the output against the original will notice. An unwrapped line is truthful about the file and runs off the sheet. Both are right sometimes: wrap a log you want to read, leave it unwrapped for a file where line boundaries carry meaning.
When wrapping is on, the fold is done carefully. Tabs are expanded to four spaces before anything is measured, the continuation is indented to match the leading whitespace of the line it came from, and the break is preferred at a space so a long path or identifier is not cut in half mid-word. The number of characters that fit is worked out from the actual width of a monospace digit at your chosen size, not guessed.
Line numbers are padded to the width of the largest number in the file and followed by two spaces, so they form a straight column and the text stays aligned all the way down. They are drawn as part of the text rather than in a margin, which means they come with you when you copy a line out of the finished PDF. That is what you want when quoting a line to somebody, and not what you want if you are going to paste the listing back into an editor.
The file is decoded as UTF-8, and a byte-order mark at the start is stripped - a BOM is a mark, not a character, and left in place it renders as an invisible-width glyph at the top of the first page in some viewers. Bytes that are not valid UTF-8 become the replacement character rather than aborting the conversion, so a file saved in an older Windows or Japanese encoding will convert but will show damage where the accented characters were. Windows, Unix and classic Mac line endings are all recognised as breaks.
The embedded font is Noto Sans Mono or Noto Sans, subsetted to the characters your file actually uses, which is what keeps a converted log at tens of kilobytes rather than megabytes. It does not cover Chinese, Japanese, Korean, Arabic or Indic scripts. Turning embedding off falls back to Courier, Helvetica and Times, which are WinAnsi only, and there a replacement character comes out as a question mark.
このツールにできないこと
- Chinese, Japanese, Korean, Arabic and Indic scripts are outside the embedded font's coverage, because the faces that would cover them are tens of megabytes each.
よくある質問
- ページに収まらない長い行はどうなりますか?
- 折り返しをオンにすると次の行へ折り返し、元の行が始まった位置に揃えて字下げし、空白があればそこで折ります。オフにすると用紙の端で切り落とされるので、ファイルの1行がページの1行のままになり、とても長い行の先のほうは表示されません。行の区切りに意味があるときはオフに、読みやすさが大事なときはオンにしてください。
- 既定が等幅なのはなぜですか?
- 列を揃えられるのは等幅の書体だけで、ここで変換されるものの多くは列で並んでいるからです。左端にタイムスタンプが並ぶログ、CSV、設定ファイル、字下げされたソースコードなど。プロポーショナルの書体では、数行のうちにその列がずれていきます。本当に文章であるまれなファイルのために、ゴシックと明朝も用意してあります。
- アクセント付きの文字が変な記号になりました。なぜですか?
- ファイルはUTF-8としてデコードされます。Windows-1252のような古い1バイト系の文字コードや日本語の文字コードで保存されていた場合、アクセント付きの文字のバイト列は正しいUTF-8ではないため、推測せずに置換文字にします。エディターでUTF-8として保存し直してから、もう一度変換してください。バイトオーダーマークがあれば自動で取り除きます。
- 複数のファイルをまとめて変換できますか?
- はい、1回で50件までです。それぞれが、元のファイル名を引き継いだ個別のPDFになります。用紙の設定・文字の大きさ・折り返し・行番号の設定はすべてのファイルに適用されるので、ログの入ったフォルダーごと変換しても仕上がりが揃います。ファイル名の欄は、1件だけ変換するときにだけ使われます。
- ファイルはアップロードされますか?
- されません。バイト列のデコードとレイアウトはブラウザーの中のWeb Workerで行われ、PDFもそこで書き出されます。このページが出す通信は、このサイト自身のオリジンからNotoのフォントを取ってくるものだけで、それもUnicodeの埋め込みがオンのときだけです。信じるより確かめたい方は、ブラウザーのネットワークタブを開いて何か変換してみてください。