← Back

TXT to PDF

Convert text content into a printable PDF

About TXT to PDF

TXT to PDF turns plain text into a page you can save as a PDF. You either choose a .txt file or paste text straight into the box, check the white preview that appears below, then click 'Print / Export as PDF' and set the destination to 'Save as PDF' in your browser's print dialog. One thing to be clear about up front: the tool does not build a PDF file itself. It relies on your browser's built-in print feature, so paper size, margins, headers and footers are all controlled by the browser's print dialog, and the tool has no options for them.

How to use it

  1. Click the dashed box 'Click to select a TXT file' and choose a .txt file. Or skip that and paste or type text into the box labelled 'You can also paste or edit text directly here'.
  2. As soon as there is text, a white preview appears under the box, keeping your line breaks and spaces as they are. After loading a file you can still edit the text in the box.
  3. Click 'Print / Export as PDF'. The button is greyed out while the box is empty or contains only whitespace.
  4. In the browser's print dialog, set the destination to 'Save as PDF' (Chrome or Edge), or on macOS use the PDF menu at the bottom left and choose 'Save as PDF'. Adjust paper size and margins if you like, then save.

What the printed result looks like

While printing, the upload box, the text box and the button are hidden. Only the preview text remains, with its border and padding removed, so the PDF contains just your text. It uses the page's default font and the preview's styling, keeps every line break from your text, wraps overly long lines, and is split across pages automatically when it runs past one page. Because the browser renders the text itself, Chinese, English and symbols display normally. The tool offers no controls for font, size, line spacing, page numbers or titles. For that you are limited to what the browser print dialog offers, or you should use a word processor.

Limits and known behavior

  • Files are decoded as UTF-8. If your .txt is in an older encoding such as GBK, GB2312 or Big5, the text may appear garbled and no error is shown. Re-save it as UTF-8 in a text editor and select it again.
  • The file picker accepts .txt and plain-text types only. Other formats such as .docx or .pdf cannot be loaded directly; for Word content, copy and paste it into the text box.
  • Plain text only. Bold, colors, images and tables do not exist in a TXT file, and the tool has no layout options.
  • Page size, orientation, margins and whether headers and footers appear are set in the browser's print dialog, and option names vary between browsers. Browsers may print the web address and date in the header and footer by default; you can untick that in the dialog.
  • One text at a time. Choosing another file replaces what is in the text box, including edits you made by hand.
  • No file size limit is set in the code, but very long text makes the preview and pagination slower. The practical limit depends on your device and browser.
  • Because export depends on the browser's print feature, you need a browser or system that offers 'Save as PDF'. Current Chrome, Edge and Safari do.

Why doesn't clicking the button download a PDF directly?

The tool uses the browser's print route to produce the PDF, so clicking the button opens the print dialog and you choose to save as PDF there. The benefit is that Chinese text does not depend on any bundled font file. The cost is that page settings are made in the print dialog instead of on the tool page.

Will Chinese text turn into garbage or empty boxes?

With printing, the fonts come from your own device, and common system fonts cover Chinese. Garbled text usually comes from the source file's encoding: if the .txt is not UTF-8 it is already garbled when read, and you can see that in the preview before exporting.

Why does the preview keep my line breaks instead of reflowing paragraphs?

The preview displays whitespace exactly as written, so every line break and run of spaces shows up as is. That fits plain text, but it also means that if your TXT was hard-wrapped at a fixed width, the PDF will break lines in the same places. To reflow paragraphs, edit the text in the box first.

Can I merge several TXT files into one PDF?

The tool handles one text at a time and has no batch mode. To combine files, paste their contents into the same text box and export once.

Can I select text in the exported PDF?

Usually yes. Since the browser outputs the page text directly, it is normally stored as text rather than as an image. The result still depends on your browser and print driver, so open the PDF and check it.

Privacy and processing

Reading the file, previewing and printing all happen in your browser, and the page code contains no network request that sends your text to a server. A selected file is only read into browser memory as text and is not uploaded. Note that if you choose a real printer instead of 'Save as PDF' in the print dialog, your system's print service handles the content, which is your own choice. Closing or refreshing the page clears the text box.