Forum Discussion
How to convert TXT to PDF?
I have some notes saved as .txt files and need PDF copies for sharing and printing. They’re mostly plain text with paragraphs and a few lists, so I just need readable pages with sensible spacing and no text cut off at the edges.
Would a TXT to PDF converter be the easiest option, or can I do this directly from the app I use to open the files? I’d like to keep the existing line breaks so the notes are still easy to follow.
Is there a straightforward way to do this for free? Thanks for any help.
6 Replies
- NathanReedIron Contributor
For a single TXT file, an online converter or your computer’s built-in Print to PDF option is usually enough. If you have several files to convert, dedicated desktop PDF software can process them in a batch instead of one at a time.
Your existing paragraph breaks can carry over, but a TXT file does not contain fixed fonts, margins, or page sizes. The converter creates that page layout, so long lines may wrap differently in the PDF.
Online: convert TXT to PDF for free with PDFgear
PDFgear’s TXT to PDF converter lets you convert text to PDF online from a saved TXT file without installing software. This free online text to PDF converter adds no watermark and is suitable for notes you want to share or print.
- Open PDFgear’s TXT to PDF online tool.
- Click Select TXT File and choose your .txt file.
- Wait for the file to convert automatically.
- Click Download File and open the PDF to review the result.
The browser tool also lets you convert text to PDF on Android or convert text to PDF on iPhone. Choose the TXT file from your phone’s file picker, then download the PDF when it is ready.
This method uploads your file for processing. If your notes must remain on your computer, the built-in methods below provide a straightforward alternative.
Built-in tools: save TXT as PDF on Windows or Mac
For occasional conversions, you can convert text to PDF on a laptop directly from the application that opens your notes. Both Windows and Mac provide free PDF output options without additional software.
On Windows, use Notepad:
- Open your TXT file in Notepad.
- Select File > Page Setup to check the paper size, orientation, and margins.
- Select File > Print and choose Microsoft Print to PDF.
- Click Print, enter a filename, and save the PDF.
- Open the saved file and check that the text fits within the pages.
If the PDF includes an unwanted filename or page number, remove the header or footer entries in Notepad’s Page Setup before printing again.
On Mac, use TextEdit:
- Open your TXT file in TextEdit.
- Select File > Print.
- Choose the paper size and orientation, then check the page preview.
- Open the PDF menu and select Save as PDF.
- Enter a filename, choose a location, and click Save.
Review long lines in particular. If the text does not fit comfortably, adjust the font size or page settings before saving.
Desktop: batch convert TXT files to PDF with PDFgear
The built-in methods work well for individual files, while a TXT to PDF converter app can process a larger collection in one batch. PDFgear lets you batch convert TXT files to PDF for free on Windows and Mac, creating a separate PDF for each source file.
- Download and open PDFgear.
- Select All Tools > TXT to PDF.
- Click Add Files and select the TXT files you need.
- Choose an output folder and click Convert.
- Open the saved PDFs and check the text layout.
You can import the files directly without copying and pasting their contents. Before converting a large batch, try one file with long paragraphs and indented lists to check how the converter handles wrapping and spacing.
What happens to line breaks and spacing?
When you convert text to a PDF file, line breaks entered with the Return or Enter key belong to the source text. Automatic wrapping at the edge of your text editor’s window does not—it can change when the text is fitted onto PDF pages.
Lists aligned with repeated spaces or tabs need particular attention because their appearance depends on the font and tab spacing. If accented characters or symbols appear incorrectly, check the source file’s encoding; saving a correctly displayed copy as UTF-8 can help avoid compatibility problems.
Before sending the PDF, inspect the longest lines, list indentation, and page edges. For your notes, readable paragraphs and complete text matter more than matching the exact width of the original editor window.
- Emily2002Iron Contributor
Google Docs is a free online option for converting TXT notes to PDF.
- Upload the .txt file to Google Drive.
- Right-click it and choose Open with > Google Docs.
- Use File > Page setup to select Pages mode and adjust the margins.
- Choose File > Download > PDF Document (.pdf).
Check the line breaks and list spacing before downloading. Long lines wrap to the page width, and a monospaced font helps with lists aligned using spaces. The file is uploaded to Google, so this suits notes you’re comfortable storing online.
- Ryan_C1Iron Contributor
Adobe Acrobat can convert TXT files directly to PDF, although this requires a paid Acrobat plan rather than the free Acrobat Reader.
- Open Acrobat and choose Create a PDF > Single file.
- Select your .txt file.
- Click Create, review the pages, and save the PDF.
Existing line breaks should carry over, but check long lines, list indentation and any unusual characters before sharing. Plain-text files don’t store fonts or page margins, so the converter supplies those settings.
If you already have paid Acrobat, this is convenient. For a one-off conversion of simple notes, though, there’s little reason to buy it—printing from your text editor to PDF is usually enough.
- Eric_BrooksIron Contributor
fpdf2 is another free Python option. Its multi_cell() method wraps text within the page margins, which addresses your concern about lines being cut off.
Install it:
python -m pip install fpdf2
Put a Unicode TrueType font such as DejaVuSans.ttf beside your TXT file, then save this as convert.py:
from pathlib import Path
from fpdf import FPDF
text = Path("notes.txt").read_text(encoding="utf-8-sig")
pdf = FPDF()
pdf.set_margins(18, 18, 18)
pdf.set_auto_page_break(auto=True, margin=18)
pdf.add_page()
pdf.add_font("NotesFont", fname="DejaVuSans.ttf")
pdf.set_font("NotesFont", size=11)
pdf.multi_cell(w=0, h=6, text=text.expandtabs(4))
pdf.output("notes.pdf")Run python convert.py to create notes.pdf.
Existing newline characters are retained, and additional wrapping happens when a line reaches the margin. The font is embedded in the PDF, helping it display consistently on other computers. Choose a font that contains the characters used in your notes.
This takes more setup than printing from a text editor, but it’s useful when you want the same page settings every time.
- LauraBennettIron Contributor
Python + ReportLab is a free, local option, especially if you regularly convert TXT files and want consistent page settings.
Install ReportLab, read the TXT file using the correct encoding, and use SimpleDocTemplate to set the page size and margins. Add the text with Preformatted to preserve line breaks and spacing, set a maximum line length for wrapping, then build the PDF.
ReportLab handles pagination automatically. A monospaced font works well for lists aligned with spaces; for other languages, choose a font that supports the characters.
It requires some Python setup, so it’s more useful for repeat conversions than a one-off file.
- Jason_MIron Contributor
Microsoft Word is useful if you want to tidy the spacing before creating the PDF. There’s no need to buy it just for this job, but it’s convenient if you already have a licence.
Open the TXT file in Word. If an encoding dialog appears, choose the encoding that displays the text correctly—often UTF-8. Then select the text and set a readable font size, sensible margins and paragraph spacing. Setting Before/After spacing to 0 helps avoid adding extra gaps where your file already has blank lines.
Choose File > Save As or Export, then select PDF.
Word preserves the imported line breaks, although page wrapping depends on your font and margins. Check the preview before exporting, particularly if your lists use tabs or spaces for alignment.