TXT to PDF: plain text into a clean, printable file
By the getPDF team · Published 11 October 2026
The short answer
A .txt file becomes a PDF through the print dialog you already have. On Windows, open it in Notepad, press Ctrl+P and pick Microsoft Print to PDF; on a Mac, open it in TextEdit, press Cmd+P and choose Save as PDF from the PDF menu. Before you save, check the preview for 2 traps: long lines running off the page, and letters such as ä or ł printing as symbols.
For a letter or notes that should look typeset rather than typed, paste the text into Word or Google Docs instead and export from there. For logs, code and transcripts, keep it plain and monospace, as below.
getPDF has no text to PDF converter, because the print dialog genuinely is the answer. Where it helps is after: several converted logs into 1 file, page numbers on an exhibit.
Merge PDFCombine files, reorder, keep bookmarks. Free, runs on your device.Which route should I use?
| Your text | Route | Keeps monospace | Long lines |
|---|---|---|---|
| A log, code, a data dump | Notepad or TextEdit, print to PDF | Yes, with a monospace font set | Check the preview; landscape helps |
| Any .txt, quickly, on any system | Open it in Chrome or Edge, print to PDF | Yes | Wrapped to the page width |
| A letter, notes, a transcript to read | Paste into Word or Docs, then export | Your choice | Reflowed into paragraphs |
| Many files, the same way every time | A command-line tool such as pandoc | Your choice | Your choice |
On Windows: Notepad and Microsoft Print to PDF
- Open the file in Notepad. Double-click a .txt and it usually opens there.
- Set the font, if columns matter. Notepad uses Consolas by default, which is monospace; if someone changed it, set it back in Notepad’s settings under Font.
- Press Ctrl+P and pick Microsoft Print to PDF as the printer.
- Check orientation and the preview. Wide logs read better in landscape.
- Click Print, then name the file and choose where to save it.
Notepad’s page setup (File, Page setup) sets margins and the header and footer it prints on each page, where you can put a file name or a page number. If Microsoft Print to PDF is missing from the printer list, it is a Windows feature that can be switched back on; the Windows print-to-PDF guide in this cluster covers it.
On a Mac: TextEdit and Save as PDF
- Open the file in TextEdit. A .txt opens as plain text.
- Press Cmd+P.
- Open the PDF menu at the bottom left of the print dialog and choose Save as PDF.
- Name it and save.
In the print dialog, the TextEdit section has a Print header and footer option for the file name, date and page numbers on each page. Untick it for a clean copy.
The browser route: wrapped, monospace, everywhere
Drag the .txt file into a Chrome or Edge window. The browser shows it as plain monospace text and wraps long lines at the window edge. Then Ctrl+P (Cmd+P on a Mac), Destination Save as PDF, and in More settings untick Headers and footers unless you want the file path and date on every page. This route behaves the same on Windows, macOS and Linux, which makes it the one to give a colleague.
Long lines: the trap in every log file
A log line of 300 or 400 characters does not fit on an A4 page in any readable size. Depending on the program, it either wraps onto the next line (sometimes in the middle of a word) or simply stops at the right margin, and the rest of the line is not in the PDF at all. The second case is the dangerous one: nothing warns you, and the PDF looks fine until someone needs the end of line 2,481.
Three fixes, in order of effort:
- Look at the preview in the print dialog and find the longest line. If it ends at the margin without continuing, the program cuts.
- Switch to landscape and, if needed, a smaller font (8 or 9 points in a monospace font still reads well in a PDF).
- Use the browser route, which wraps every line to the page.
Letters print as symbols: the encoding trap
A file written in UTF-8 and read as an older Windows or Mac encoding (or the other way round) turns ä into ä and ł into a box or a question mark. The text in the file is fine; the program guessed wrong. Fix the reading, not the file:
- TextEdit: File, Open, select the file without opening it, click Options, and pick the encoding in Plain Text Encoding (UTF-8 for almost every modern file). Apple documents this in “If characters aren’t displayed correctly in TextEdit” (Apple Support, checked on 11 October 2026).
- Windows: Notepad shows the encoding it chose at the bottom right of the window. To read the file in a different one, a free editor such as Notepad++ is the dependable route: its Encoding menu lets you pick the character set the file was really written in, and then convert it to UTF-8.
Print only once the preview shows the letters right. A PDF made from mangled text keeps the mangled text, searchable and all.
The nicer route: paste into Word or Docs
For a letter, meeting notes or an interview transcript, a monospace printout looks like a 1990s fax. Paste the text into Word or Google Docs, pick a proportional font and real margins, and export: in Word, File, Export, Create PDF/XPS; in Docs, File, Download, PDF document. The text reflows into paragraphs, so hard line breaks inside sentences (common in text copied from emails) need a quick find and replace first.
Do not do this for logs or code. A proportional font gives an “i” less room than an “m”, so columns that lined up stop lining up, and the reader cannot tell which value belongs to which field.
After the PDF: merge, number, compress
An exhibit for a dispute in Linz is often 6 log files that must go in as 1 numbered document. Each step runs in your browser, nothing is uploaded:
- Merge PDF: add the 6 PDFs, order them with Up and Down, Merge. Bookmark per file gives each log its own entry.
- Add page numbers: Page 1 format, at the bottom right, so “see page 14” means something. The numbers are added as real text.
- Compress PDF: usually unnecessary. A text-only PDF is small already, and the tool returns it unchanged and says why.
What the print route cannot do
The honest part:
- It does not reflow or tidy text. What is in the .txt is what prints, including trailing spaces and tab widths.
- Some programs cut long lines silently. Check the preview, as above.
- It cannot repair a file in the wrong encoding; it only shows what the program read.
- getPDF does not convert TXT to PDF. The built-in route is free, local and exact; we would only be wrapping it.
Questions
How do I convert a .txt file to PDF on Windows?
Open it in Notepad, press Ctrl+P, pick Microsoft Print to PDF as the printer, click Print and name the file. It takes about 20 seconds and needs nothing installed.
How do I convert a .txt file to PDF on a Mac?
Open it in TextEdit, press Cmd+P, open the PDF menu at the bottom left of the print dialog and choose Save as PDF.
Why do letters like ä or ł come out as strange symbols?
The program read the file in the wrong character encoding. Reopen it in the right one before printing: on a Mac, File, Open, Options, Plain Text Encoding in TextEdit; on Windows, a free editor such as Notepad++ lets you pick the encoding from its Encoding menu.
How do I keep columns in a log file lined up?
Keep a monospace font (Consolas, Courier, Menlo). Every character is the same width there, so columns stay aligned. A proportional font such as Calibri or Arial pulls them apart.
Does getPDF convert TXT to PDF?
No, and you do not need it to: every computer prints text to PDF already. getPDF helps after that, on your device: merging several converted files into 1, numbering the pages of an exhibit, compressing if needed.
The tools for this job
Keep reading
- Markdown to PDF: 3 routes that keep the formattingTurn Markdown into a PDF with the browser's print dialog, VS Code or pandoc.
- Create a PDF from anything, free and on your deviceCreate a PDF from Word, Google Docs, a web page, an email or plain text.
- Print to PDF on Windows 11, and bring it back when it is missingPrint to PDF on Windows 11 with Ctrl+P and Microsoft Print to PDF.
- Print to PDF on a Mac: the PDF menu in every print dialogSave any document as a PDF on a Mac: Cmd+P, then the PDF menu, Save as PDF.
- Save an email or a whole thread as a PDF, attachments includedSave an email or a whole thread as a PDF in Gmail or Outlook for records or disputes.