PDF places text; it does not wrap paragraphs for you

A PDF page describes strings drawn at particular coordinates. Unlike an HTML container or word processor, the format does not automatically move an overflowing word to the next line. The generator measures candidate lines against the width between the margins and emits a separate drawing instruction for each line it constructs.

Font metrics determine each line break

The core operation is measuring the pixel (or point) width a string of text would take up in a specific font at a specific size, every font has metrics data for exactly this, since every character has a defined width at a given size. A generator builds a line word by word: add the next word, measure the resulting line's width, and if it's still narrower than the available page width (page width minus the left and right margins), keep it; if adding the word would overflow, that word starts a new line instead.

Measuring one word to decide if it fits Helvetica = 49.044pt wide at 12pt A4 page width (595.28pt) βˆ’ 50pt margin each side = 495.28pt available for text β‰ˆ 10 words this length fit on one line before wrapping
Real measured values: "Helvetica" at 12pt Helvetica is exactly 49.044 points wide (computed via pdf-lib's own font metrics), that's the unit a word-wrap algorithm actually works in.

The vertical limit creates the next page

Once a generator has a full list of wrapped lines, it places them one below another, moving down by one line height each time, until the next line would fall below the bottom margin, at that point, it starts a new page and continues from the top margin. It's the same greedy, one-item-at-a-time approach as word wrap, just applied to lines instead of words, and to vertical space instead of horizontal space.

Drawing PDF text preserves capabilities a screenshot loses

Writing actual PDF text instructions normally produces selectable and searchable characters. A canvas screenshot placed on a page contains pixels instead, so it needs OCR before users can search or copy the words. Text extraction and accessibility still depend on font encoding, character maps and document structure; selectable text alone does not guarantee a perfectly tagged or accessible PDF.

Where layout needs extra care

What happens to a single word longer than the whole line width? A well-behaved generator falls back to breaking the word itself, character by character, rather than letting it overflow the page or getting stuck in an infinite loop, this matters for things like long URLs with no spaces.

Do different fonts wrap text differently at the same size? Yes, each font has its own character widths (a monospace font like Courier has identical widths for every character, while Helvetica or Times have variable widths per character), so the same text at the same point size can wrap onto a different number of lines depending on the font.

Why do blank lines in my pasted text matter? A blank line is usually meant to signal a paragraph break, a generator that ignores them entirely would run every paragraph together, so preserving them as empty lines (with their own vertical space) keeps the original structure recognizable.

Convert text to a PDF

Orisod’s Text to PDF tool wraps and paginates plain text with selectable page size, font and font size, directly in your browser.

Convert text to PDF β†’

PDF text layout is a sequence of measurements, not magic: build a candidate line, compare its width, place accepted lines and start another page when vertical space runs out. Long unbroken strings, unusual Unicode characters and font limitations are the cases most likely to need special handling.