Text to PDF
How to turn a text file into a PDF
- Choose or drop a .txt, .text, .log or .md file. Each can be up to 10 MB, and you can add up to 50.
- Pick the Page size, A4 or US Letter, and a Font: Helvetica, Times or Courier.
- Set the Font size from 9 to 14 pt and the Margin to narrow, normal or wide.
- Tick Page numbers if you want a number at the bottom centre of each page.
- Click Convert to PDF, read the note for page and line counts and any replaced characters, then download the PDF or the ZIP.
What you get from a text file
Each text file becomes one PDF named after it, with the file name as the PDF title. Lines are wrapped by measured width, not by a fixed character count, and the text is real text that a PDF reader can select and search. The PDF uses the 14 standard PDF fonts, which every reader already has, so no font is embedded and the files stay small.
We tested with a generated file of 220 numbered lines (24,971 bytes, 5,290 words) that includes a line with tabs and one 140-character word. On A4 with Helvetica 11 and the normal margin it made 7 pages and 9,850 bytes, and the note read 7 pages, 309 lines. Poppler's pdftotext found 5,291 words in the PDF, one more than the input, because the 140-character word was split across two lines. The nearest text was 54 points from the left edge, 57.3 from the right, 57.1 from the top and 59.6 from the bottom, so nothing entered the 54-point margin.
The conversion runs in your browser tab. In our test the page made 17 requests: two to Google ad and analytics servers and 3 to jsDelivr for the PDF libraries, hash-checked, and no request carried a body. Only Chromium was tested.
Page size, font, size and margin
The same 220-line file on A4 with Helvetica and the normal margin made 5 pages at 9 pt (266 wrapped lines), 7 pages at 11 pt (309 lines) and 14 pages at 14 pt (527 lines). Letter with Courier at 10 pt, the narrow margin and page numbers made 6.
Choose Courier for anything laid out in columns, since every character has the same width. On Letter with the narrow margin, the longest line held 90 characters. Page numbers sit 13.6 points above the bottom edge, inside the margin, and they are real text: the Courier run read back 5,297 words, which is the 5,290 originals, the split long word and six page numbers.
Characters the standard fonts cannot draw
Accents, the euro sign, curly quotes, the en dash and the bullet all work. We converted a line containing all of those and read the same characters back from the PDF. Two Chinese characters in that line, 你好, came out as ??, and the note said 2 characters could not be drawn with the built-in fonts (Chinese, Japanese or Korean) and were replaced with ?.
When most of a file is in such a script, the page makes no PDF at all. Our Chinese, Japanese, Thai and Arabic samples were each refused with a message that names the script and ends: Use your browser's Print to PDF for this file. The page also lists Hebrew, Hindi, Korean, Greek and Cyrillic as unsupported, which we did not test one by one. A refusal beats a PDF full of question marks, or one with the text drawn as pictures that cannot be selected.
Encodings and files that are not text
The page reads a file as UTF-8, as UTF-16 when it starts with a byte order mark, and otherwise as Windows-1252. We saved one accented line (Café crème brûlée, naïve façade, Zürich, plus a euro sign and curly quotes) in all three forms, as files of 71, 114 and 56 bytes, and the three PDFs held the same text. For the Windows-1252 file the page added a note saying so and suggested UTF-8 if accents look wrong.
A file of only spaces and line breaks is refused with this file has no text in it. Binary data is refused with this does not look like a text file.
Several files and large files
Two text files gave two PDFs, and the ZIP button saved a 2,021-byte archive that unzip reported as free of errors. A 1.2 MB file with 14,001 lines made a 275-page, 391,715-byte PDF in 1.6 seconds with all 252,000 words in the PDF text. Adding a 10.8 MB file produced the message over-10-mb.txt: larger than 10 MB.
The code allows 50 files per run and 3,000 pages per file, counts we did not run. A .md file is printed as the characters it contains, with no headings or bold.
Related conversions
To read a PDF back as text, use PDF to text. Merge PDF joins the result with other PDFs, and Image to PDF covers pictures instead of text.
Measured results
| Input | Setting | What came out |
|---|---|---|
| long-notes.txt, 220 lines | A4, Helvetica 11, normal margin | 7 pages, 9,850 bytes, 309 lines; text at least 54 pt from every edge |
| long-notes.txt | A4, Helvetica 14 | 14 pages, 15,813 bytes, 527 lines |
| long-notes.txt | Letter, Courier 10, narrow, page numbers | 6 pages, 8,864 bytes, longest line 90 characters |
| Café, €5, quotes, 你好 | Defaults | Accents, euro and quotes kept; 你好 became ??; note counts 2 |
| Chinese, Japanese, Thai, Arabic samples | Defaults | No PDF; message names the script and points to Print to PDF |
| 1.2 MB, 14,001 lines | Defaults | 275 pages, 391,715 bytes, 1.6 s, 252,000 words read back |
| 10.8 MB file | Defaults | Refused when added |
When a word processor is the better choice
Use Word or LibreOffice when you need bold headings, images, tables or a script the standard fonts cannot draw. Write the document there and export it to PDF. This page is for plain text that should look tidy on paper.
Frequently asked questions
Is my text uploaded?
No. The PDF is built in your browser. In our logs no request had a body and none held the text.
Can I paste text instead of opening a file?
Not on this page. It takes .txt, .text, .log and .md files, so save the text first.
Why do Chinese, Arabic or Thai characters not work?
The standard PDF fonts only cover Western European text. A file that is mostly in another script is refused, and a few stray characters become ?. Your browser's Print to PDF handles those scripts.
How do I keep columns lined up?
Choose the Courier font. Every character has the same width, so spaces keep their columns.
How large a file can I convert?
Up to 10 MB each. A 1.2 MB file made 275 pages in 1.6 seconds in our test. A 10.8 MB file was refused.