Text to PDF

Turn pasted text or TXT, Markdown, CSV and log files into a PDF with selectable text, including Chinese, Japanese and Korean. Set paper, margins, font size, line spacing, a monospaced font, line numbers, header and page numbers; GBK and other encodings are detected.

  • Runs locally
  • Free

Use the tool

Your files are processed in your browser and are not uploaded to a server.

About this tool

Convert pasted text or TXT, Markdown, CSV and log files to PDF. The PDF contains real, selectable and searchable text, and Chinese, Japanese and Korean show correctly instead of empty boxes. Choose A4, Letter, A5 or A3 in either orientation, set margins, font size and line spacing, use a monospaced font with line numbers for code and logs, and add a header and “1 / 5” page numbers. Legacy encodings such as GBK are detected. Everything runs in your browser; nothing is uploaded.

Typical uses

  • Send meeting notes or contract text from a plain-text file as a PDF
  • Print or archive program logs and source code with line numbers
  • Combine several TXT chapters into one PDF, each starting on a new page

How to use

  1. Paste text, or open or drop one or more .txt, .md, .csv or .log files. Files are read as UTF-8; if that fails, GBK, Big5, Shift_JIS and other encodings are detected and shown, and you can choose one if the text looks garbled.

  2. Choose paper, orientation, font size, margin, line spacing and font, and add line numbers, a header and page numbers if needed. Check the page count and line breaks in the preview, click Create PDF and download it.

Good to know

Text is written as real, selectable and searchable text. Chinese, Japanese, Korean and other characters use the open-source Noto Sans CJK and Liberation Sans fonts, downloaded only when needed (about 2.1 MB for common Chinese and Japanese, 0.8 MB for Korean), with only the glyphs used embedded. Up to 20 MB (a warning above 5 MB) and 5,000 pages; characters without a font, such as emoji, appear as “?”. Markdown is not rendered; the text is set as written. Everything runs locally in your browser; nothing is uploaded.

Paper sizes and how much text fits on a page

PDF measures in points: 1 pt = 1/72 inch = 0.3528 mm. ISO 216 defines the A series, so A4 is 210 × 297 mm, or 595.276 × 841.89 pt; US Letter is 8.5 × 11 inches. The table uses the tool's defaults (11 pt type, 1.4 × line spacing, 20 mm margins, portrait) and is computed by the tool's own layout code.

Capacity of each paper size with the default settings
PapermmptLines per pageMonospaced characters per lineCJK characters per line
A4210 × 297 mm595.276 × 841.89 pt477343
Letter215.9 × 279.4 mm612 × 792 pt447545
A5148 × 210 mm419.528 × 595.276 pt314627
A3297 × 420 mm841.89 × 1,190.551 pt7011066

A default A4 page therefore holds 47 lines. In the proportional font, ordinary English prose fits more letters per line than the monospaced column count, because most letters are narrower than 0.6 em. The number of lines is the usable height minus one font size, divided by the line spacing, plus one, so tightening the line spacing gains more lines than shrinking the margins.

Common A4 combinations
UseSettingsLines per pageMonospaced charactersCJK characters
Default (prose)A4 portrait · 11 pt · line spacing 1.4 · margins 20 mm477343
Compact proseA4 portrait · 10 pt · line spacing 1.4 · margins 20 mm528048
Large printA4 portrait · 12 pt · line spacing 1.5 · margins 20 mm406640
Code (portrait)A4 portrait · 9 pt · line spacing 1.3 · margins 15 mm649456
Code (landscape)A4 landscape · 9 pt · line spacing 1.3 · margins 15 mm4314084
Logs (landscape, small)A4 landscape · 8 pt · line spacing 1.25 · margins 10 mm5416398
Live capacity hint

Whenever you change the paper, size, margins or spacing, the tool shows the lines per page and characters per line for the current settings, and the preview breaks lines exactly where the PDF will.

Why Chinese, Japanese and Korean do not turn into boxes

Many converters produce rows of empty boxes for Asian text, because PDF readers only guarantee 14 standard fonts (Helvetica, Times, Courier and a few others), none of which has Chinese, Japanese or Korean glyphs. This tool writes real text that you can select, copy and search. Latin text uses the built-in Helvetica (prose) and Courier (monospaced), with nothing to download. Other characters trigger a one-time download of an open-source font, and only the glyphs actually used are embedded — a font with tens of thousands of glyphs adds only the few hundred or thousand your text uses.

Characters and fonts (downloaded on first use, then cached by the browser)
CharactersFontDownload
English and Western European letters (é, ü, ñ, €…)Helvetica / Courier (built into PDF)0
Other Latin, Greek and Cyrillic (Polish, Czech, Russian…)Liberation Sans0.14 MB
Symbols, arrows, box drawing (├──, ✓, →)Noto Sans CJK subset0.06 MB
Common Chinese characters (GB 2312, JIS X 0208, Big5 level 1), kana, full-width punctuationNoto Sans CJK subset2.17 MB
Rare Chinese characters (Extension A and beyond)Noto Sans CJK subset4.35 MB
Korean HangulNoto Sans CJK subset0.82 MB

Emoji, and scripts that need right-to-left layout or glyph shaping (Arabic, Hebrew, Thai, Devanagari), are not supported: characters with no font are shown as “?”, and the tool lists them before you create the PDF. Noto Sans CJK and Liberation Sans are released under the SIL Open Font License 1.1, which allows embedding in documents. Japanese text uses the Simplified Chinese design of Noto Sans CJK, so a few kanji (such as 直 and 骨) look slightly different from Japanese fonts.

Text encodings and where garbled text comes from

A text file stores bytes, not the name of its encoding. When you open one, the tool first looks for a byte order mark, then decodes strictly as UTF-8. If any byte sequence is not valid UTF-8, it tries GB18030 (a superset of GBK and GB 2312), Shift_JIS, Big5, EUC-KR and Windows-1252, keeps the result that looks most like real text and shows the encoding under the file name. The default choice is “Auto-detect (UTF-8, then GBK, Shift_JIS and others)”; if the preview still looks garbled, pick the encoding yourself.

EncodingTypical source
UTF-8Modern editors, web pages, Linux and macOS, most program logs
GB18030 / GBKOlder Simplified Chinese Windows Notepad files, TXT and CSV exports from older systems
Big5Older Traditional Chinese files (Taiwan, Hong Kong)
Shift_JISOlder Japanese Windows files
EUC-KROlder Korean files
UTF-16Files saved as “Unicode” on Windows, some exported logs
Windows-1252Older Western European files; also used to read ISO-8859-1

Each text can be up to 20 MB. Above 5 MB the tool warns that layout and export take longer and that phones may run out of memory. You can open up to 50 files at once, and one PDF can have up to 5,000 pages.

Tips for printing code and logs

  • Choose “Monospaced (code, logs)” so that columns line up. A4 portrait at 9 pt with 15 mm margins gives 94 characters per line; in landscape it gives 140 characters and 43 lines per page, enough for code written to 100–120 columns.
  • Logs are usually wide: A4 landscape at 8 pt, 1.25 spacing and 10 mm margins gives 163 characters per line and 54 lines per page.
  • With “Line numbers”, each source line is numbered once and wrapped continuation lines are not, so you can refer to the original file in a review.
  • Tabs expand to spaces using “Tab width” (default 4); Chinese, Japanese and Korean characters count as two columns, as they do in a terminal.
  • A form feed (\f, Ctrl+L) forces a new page. Terminal colour codes such as ESC[31m are removed instead of appearing as stray characters.
  • Long URLs, hashes and Base64 strings with no space to break at are wrapped at the edge of the line, never cut off. Closing punctuation such as 。and )never starts a line, following East Asian line-breaking rules.
  • Several files are joined in list order; tick “Start each file on a new page”, and with the header turned on each page shows its file's name (or the title, if you set one).

Sources

Frequently asked questions

Can I copy and search the text in the PDF?

Yes. The text is written as real text, not images. Chinese, Japanese and Korean use an embedded subset of the Noto Sans CJK font, so copying returns the original characters.

My TXT file shows garbled characters. What can I do?

Files are read as UTF-8 first; if that fails, GBK (GB18030), Big5, Shift_JIS, EUC-KR and Windows-1252 are tried and the detected encoding is shown. If the preview is still garbled, choose the encoding under File encoding.

Why does the first Chinese or Japanese conversion take a moment?

The font for common Chinese and Japanese characters is about 2.1 MB and is downloaded once, only when the text needs it; Latin-only text needs no download. Only the glyphs used are embedded, so the PDF stays small.