📄

Text to PDF

Convert text to PDF: typed, pasted or uploaded .txt text becomes a paginated A4 PDF.

Your files stay on this device. Nothing is uploaded. How to check

Advertisement

How to use Text to PDF

1. Type or paste your text into the box, or drop a .txt file on the upload zone (or click Choose Files) to load it into the box, where you can still edit it.
2. Pick a Font Size: 11 pt, 13 pt or 16 pt.
3. Click Convert Text to PDF, then Download File to save converted_document.pdf or Preview Document to check it first.

Key features of Text to PDF

📝 Wraps at the page edge

Each line is wrapped to the printable width using Helvetica's real character widths, so nothing is cut off. Line breaks and blank lines in your text are kept.

📄 As many pages as needed

Text flows onto new A4 pages with a 50 point margin whenever the current page is full.

🔒 Nothing is uploaded

The text is laid out by JavaScript in your browser with pdf-lib. Nothing is sent to a server.

About Text to PDF

Text to PDF sets your text in Helvetica at 11, 13 or 16 points with pdf-lib, wrapping each paragraph to the width of an A4 page and starting a new page when the current one is full. A .txt file you drop on the page is loaded into the text box first, so you can trim or correct it before converting.

It is useful for turning notes, a log file, a licence text or a plain email into something that prints and attaches cleanly. It handles plain text only: Markdown or HTML markup is printed as typed, there is no bold or heading style, and characters the built-in Helvetica font cannot draw, such as Chinese or Arabic script, are replaced with a question mark.

When to use Text to PDF

A chat export, an interview transcript or a support ticket thread arrived as a .txt file and needs to go into a case file. Drop it on the zone, pick 11 pt to keep the page count down, and convert. Line breaks are kept, so each message still starts on its own line.

You keep reading notes, a packing list or a study summary in a plain text editor and want it on a tablet where you can mark it up. Convert it here, then annotate with PDF Draw or PDF Highlight; because the output is real text, the highlighter can find the words.

A licence, a changelog or a README has to be attached to a submission that accepts only PDF. Paste it, convert, and rename converted_document.pdf to something descriptive after downloading.

Source code and tab-aligned tables are a poor fit: Helvetica is a proportional font, so columns drift and indentation is only approximate. Anything that needs headings or emphasis should start as markup for HTML to PDF. To pull text out of a PDF, the reverse job, use PDF to Text, and to stamp page numbers on the result use Add Page Numbers.

Tips and troubleshooting

  • The alert Please enter or upload some text to convert appears when the box is empty or holds only spaces and blank lines.
  • The file picker lists .txt files only, but drag and drop accepts any file and loads its bytes into the box as text, so a .md, .log, .csv or .json file works that way. A binary file just fills the box with garbage. Only the first file is loaded, and it replaces whatever the box held.
  • About 49 lines fit on a page at 11 pt, 41 at 13 pt and 34 at 16 pt, counted after wrapping. A line of yours that is wider than the page takes two or more of those.
  • Wrapping breaks only at spaces. A URL or a token longer than the printable width, 495 points, is kept on one line and runs past the right margin and off the page. Break it by hand before converting.
  • Every character the built-in Helvetica font cannot draw, such as Polish ł, Greek, Chinese or an emoji, becomes a question mark. Indentation at the start of a line is kept and a tab counts as four spaces, but continuation lines produced by wrapping start at the margin.
  • A large log file sits in the text box before conversion and every line becomes one draw operation, so tens of thousands of lines make the page sluggish and produce hundreds of pages. Trim the file first.
  • The download is always named converted_document.pdf, on A4 with a 50 point margin; there is no Letter, margin or font choice beyond the three sizes. Preview Document shows it in your browser's own PDF viewer.

How Text to PDF works in your browser

Everything starts from the text box: a dropped .txt file is read with File.text() and placed there, so what you convert is always what the box shows. On Convert Text to PDF the script trims the text, splits it at line breaks, and wraps each line word by word, asking pdf-lib's Helvetica for the width of the candidate line at your chosen size and breaking before it would exceed 495 points, the width of an A4 page minus two 50 point margins. Tabs become four spaces and characters Helvetica cannot draw are swapped for question marks before any width is measured.

pdf-lib then adds an A4 page and writes the lines from the top down, 1.4 times the font size apart, starting a new page whenever the next line would land below 60 points. Helvetica is one of the standard fonts every viewer provides, so no font is embedded and the file is small: the PDF is your text plus a few page objects. The document is saved to bytes and offered as a Blob; nothing leaves the browser, and apart from Google Analytics while it is switched on, the page's only network request is the pdf-lib script from cdnjs.cloudflare.com at load time.

Frequently asked questions

Are long lines cut off?

No. Every line is wrapped to the page width using the font's real character widths, so all of your text appears.

Can I use bold, headings or bullet formatting?

Not here; the text is set in a single font and size. For a formatted document, write it in Word and use Word to PDF, or use HTML to PDF for styled markup.

What about accented and non-Latin characters?

Accented letters of Western European languages work, as do curly quotes, dashes, bullets and the euro sign. Characters that the built-in Helvetica font cannot draw, such as Polish ł, Chinese or Arabic script, are replaced with a question mark.

How many lines fit on a page?

About 49 lines at 11 pt, 41 at 13 pt and 34 at 16 pt, after wrapping. A line of your text that is wider than the page counts as two or more.

Can I convert a .md, .log or .csv file?

Yes, by dragging it onto the upload zone; the file picker lists only .txt files, but a dropped file of any kind is loaded into the box as plain text. Markdown symbols and CSV commas are printed as they are.

Is the text in the PDF selectable and searchable?

Yes. The PDF contains real text in Helvetica, not an image, so you can select, copy and search it, and PDF to Text can extract it again.

Last reviewed