Skip to content

Text to PDF

Set a .txt, .log or .csv as a PDF listing.

Processed on your device

This tool runs entirely in your browser. Your file is never uploaded, and you can verify that in your browser's network tab. Verify it yourself: open your browser's network tab and watch. You will see one small request asking whether you have tasks left - a tool name and a hash, never the file.

What this does

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.

How it works

  1. Drop your .txt, .log, .csv or .md files onto this page. Up to 50 at a time, each up to 50 MB.
  2. 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.
  3. 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.
  4. 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.
  5. Turn on line numbers if you expect to refer to a particular line, then press Convert.
  6. 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.

What this tool cannot do

  • 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.

Questions people ask

What happens to lines that are too long for the page?
With wrapping on they are folded onto the next line, indented to match where the original line started and broken at a space where one is available. With wrapping off they are clipped at the page edge, so what you see is one page line per file line and the far end of a very long line is not shown at all. Turn it off when line boundaries matter and on when readability does.
Why is monospace the default?
Because a monospace face is the only one that keeps columns aligned, and most of what people convert here is columnar: logs with timestamps at the left, CSVs, configuration files, indented source. In a proportional face those columns drift apart within a few lines. Sans and serif are available for the occasional file that really is prose.
My accented characters came out as odd symbols. Why?
The file is decoded as UTF-8. If it was saved in an older single-byte encoding such as Windows-1252, or in a Japanese encoding, the bytes for accented characters are not valid UTF-8 and are replaced rather than guessed at. Re-save the file as UTF-8 in your editor and convert again. A byte-order mark, if there is one, is stripped automatically.
Can I convert several files at once?
Yes, up to 50 in one pass, and each becomes its own PDF named after the source file. The page setup, type size, wrapping and line-number settings apply to all of them, so a folder of logs comes out consistent. The file name field applies only when you convert a single file.
Does my file get uploaded?
No. The bytes are decoded and laid out in a Web Worker inside your browser and the PDF is written there. What the page does fetch is the Noto font from this site's own origin, and only when Unicode embedding is on, alongside the small request that asks whether you have tasks left. Open your browser's network tab and convert something if you would rather check than take our word for it: your text is in neither.

Related tools