Cadmeo

Text to PDF Converter

Assembled in your browser. Nothing is uploaded.

133
Characters
3
Lines
483 pt
Text width
Status

Set the options, then create the PDF.

The text to PDF converter turns plain text into a properly paginated PDF, wrapping long lines to the page width and starting a new page when the current one fills. The PDF is built in your browser using pdf-lib. Nothing is uploaded.

How it works

PDF has no concept of flowing text. Every line has to be positioned explicitly, which means the wrapping and pagination have to be calculated before anything is drawn.

  1. The available text width is the page width minus both margins.
  2. Each line is measured word by word using the embedded font’s metrics, and broken when the next word would overflow.
  3. A running vertical position tracks where the next line goes.
  4. When that position would fall below the bottom margin, a new page starts.

Helvetica is used because it is one of the 14 standard PDF fonts every reader has built in, so nothing needs embedding and the file stays small. It also means the character set is limited to WinAnsi. Most Latin text is fine, but Cyrillic, Greek and CJK are not.

Examples

A4 with default margins

Page size

A4

Font size

12pt

Margin

56pt

Result

Text width of 483 pt, roughly 90 characters per line

595.28 pt page width minus two 56 pt margins. Around 60 to 90 characters per line is the range that reads comfortably.

Blank lines between paragraphs

Text

First paragraph.

Second paragraph.

Result

A blank line is preserved as vertical space

Empty lines produce an empty line in the output rather than being collapsed, so paragraph spacing survives the conversion.

Frequently asked questions

Why do accented or non-Latin characters fail?

Because Helvetica, one of the 14 standard PDF fonts, uses the WinAnsi encoding. That covers most Western European characters but not Cyrillic, Greek, Hebrew, Arabic or CJK. Supporting those requires embedding a font, which would add hundreds of kilobytes to every file.

How does word wrapping decide where to break?

Greedily: words are added to the current line until the next one would exceed the text width, measured with the actual font metrics rather than by counting characters. This is the same approach a word processor uses for a simple paragraph.

What margin should I use?

56 pt is about 20 mm and suits most documents. Below about 36 pt the text runs close to the edge and some printers will clip it, since most cannot print to the paper edge.

Can I control fonts, bold text or headings?

Not in this tool. Plain text has no way to express them. Use the Markdown to PDF converter if you need headings, lists and code blocks.