PDF to TEI XML converts a PDF into a Text Encoding Initiative P5 document. Drop a PDF onto the upload card — the tool reads every page with pdf.js, extracts text and font metadata, detects headers by font size, groups lines into paragraphs, encodes page breaks, and writes a TEI file with a properly structured <teiHeader> and <text> body. Fill in metadata (title, author, publisher, date, language), choose extraction options, and press Generate TEI XML. Everything runs in your browser — no uploads, no account. Download the .xml and open it in Oxygen XML, TEI Garage, eXist-db or any generic XML editor.
What does the PDF to TEI XML tool do?
The PDF to TEI XML tool converts a PDF into a TEI P5 XML document. It reads every page with pdf.js, extracts text and font metadata (font size, font name), detects headers by comparing each line’s font size to the median for that page, groups consecutive lines into paragraphs based on vertical spacing and font consistency, encodes page breaks as <pb/> elements, wraps bold and italic spans in <hi rend="bold"> and <hi rend="italic">, and writes a complete TEI document with a properly structured <teiHeader> and <text> body.
People search for "PDF to TEI" or "TEI XML converter" when they work in digital humanities and need to encode a historical text, a scholarly edition or a research paper as TEI for a library catalogue, an archive, a textual scholarship project, or a corpus. TEI is the established XML standard for literary and historical texts, and this tool gets a first-pass TEI file from a PDF in seconds — ready to open in an XML editor and refine.
Under the hood, the tool uses pdf.js to read the PDF — the same engine Firefox uses to display PDFs, so it handles every common PDF correctly. Everything runs client-side; nothing is uploaded.
Important: the output is a first-pass TEI file. It gives you the structure, headers, paragraphs and page breaks automatically. Manual work in an XML editor (adding names, dates, places, footnotes, commentary) is still required for a scholarly edition. Treat the output as a starting point, not a finished transcription.
How do I convert a PDF to TEI XML?
- Add your PDFDrag a PDF onto the upload card, browse your device, or import from Google Drive or Dropbox. The tool reads the document in your browser with pdf.js — nothing is uploaded.
- Fill in TEI metadataEnter a title, author, publisher, date, language and source description. These populate the TEI header’s <fileDesc> and <sourceDesc> elements so your output is a valid scholarly edition, not a plain text dump.
- Choose extraction optionsPick whether to detect headers by font size, split paragraphs on font change, encode page breaks, preserve line breaks, and include a facsimile pointer. The preview updates live with the first page’s TEI.
- Generate and downloadPress Generate TEI XML. The tool builds a TEI P5 document from every page, encodes headers and paragraphs using font metadata, and downloads a .xml file ready for import into TEI-aware tools like Oxygen, TEI Garage or eXist-db.
What can the tool do?
| Feature | What it does | Default |
|---|---|---|
| TEI P5 header | Generates <teiHeader> with titleStmt, publicationStmt, sourceDesc. | Always on |
| Header detection | Larger-than-median font size → <head>. | On |
| Paragraph grouping | Consecutive lines merged into <p>. | On |
| Page breaks | Each page begins with <pb n="N"/>. | On |
| Facsimile | Optional <facsimile> block with one <surface> per page. | Off |
| Line breaks | Preserve physical line breaks as <lb/>. | Off |
| Bold/italic | Detect from font names, wrap in <hi rend="..."/>. | On |
| Language | Set @xml:lang on <text>. | eng |
What is TEI?
TEI (Text Encoding Initiative) is the standard XML vocabulary for encoding historical documents, literary texts and scholarly editions. It has been the de facto standard in the digital humanities since 1987, used by thousands of projects: Oxford Text Archive, Perseus Digital Library, Shakespeare’s Sonnets Archive, the EEBO-TCP corpus and every major digital library.
- Humanities-focused: TEI was designed by and for literary scholars, historians and linguists — the schema reflects the way humanists think about texts.
- Interoperable: TEI files open in Oxygen XML, TEI Garage, eXist-db and any generic XML editor, and render to HTML/PDF via the official XSLT stylesheets.
- Fine-grained: TEI can mark up people, places, dates, quotations, footnotes, abbreviations, editorial interventions — the level of granularity a critical edition needs.
- Validated: The TEI P5 schema (Relax NG) is maintained by the TEI Consortium and can be customized per project via Roma.
What does the TEI output look like?
A minimal TEI file from this tool has three top-level blocks:
<teiHeader>— bibliographic metadata: title, author, publisher, date, source, language, and a<encodingDesc>noting how the encoding was produced.<facsimile>— optional; when enabled, one<surface>per page with a<graphic/>pointer.<text>— the actual transcription: one or more<div>s containing<head>and<p>elements, with<pb/>between pages.
Everything is wrapped in <TEI xmlns="http://www.tei-c.org/ns/1.0"> — the standard P5 namespace.
When do you need PDF to TEI XML?
Scholarly editions
Convert an OCR’d historical text into TEI as the first step of a critical edition.
Library digitization
Feed TEI into a library catalogue or a digital collection platform.
Digital humanities
Build a corpus for computational analysis, topic modelling or stylometry.
Research papers
Encode a published paper as TEI for a repository or a citation graph.
Manuscripts
Turn a typescript or a transcription PDF into a TEI-friendly text file.
Corpora
Produce structured text for linguistic corpora with page and paragraph alignment.
Does the tool upload my PDF to a server?
No. The document is read, extracted and encoded entirely in your browser with pdf.js. Nothing is uploaded, nothing is sent anywhere, and nothing remains after you close the tab. That makes it safe for manuscripts, rare books, restricted archives and any digitized material subject to license terms.
- Local read. Every page is read in memory in your browser tab.
- Local encode. The TEI file is built in JavaScript and handed back as a download.
- No account needed. You can convert PDFs without logging in. Read our privacy policy for details about the site.
Tips for clean TEI output
- Run OCR first for scans. If the PDF is a scanned image with no text layer, the tool has nothing to extract. OCR it first, then convert.
- Fill in metadata carefully. Title, author, publisher and date end up in
<titleStmt>and<publicationStmt>; these are the first thing a reader sees in an XML editor. - Turn on facsimile only if you have scans. The
<facsimile>block references placeholder image URLs — fill them in later with the actual page image URLs from your repository. - Preserve line breaks for verse. For poetry, turn on "Preserve line breaks" so each physical line becomes a
<lb/>instead of being joined into a paragraph. - Review the header detection. A title page with an unusually large font will become many headers; a page with just body text will become paragraphs. Skim the output before committing.
- Validate. Open the file in Oxygen XML or run it through TEI Roma to confirm it validates against the P5 schema before publishing.
Common problems and quick fixes
| Problem | Likely cause | Fix |
|---|---|---|
Empty <text> element | Scanned PDF with no text layer | Run OCR first, then convert |
| Every line is a header | Page uses a uniform large font | Turn off "Detect headers" |
| No paragraph breaks | Lines have similar spacing | Turn on "Preserve line breaks" for a per-line output |
| Bold or italic missing | Font names don’t contain "Bold"/"Italic" | Some PDFs use generic font names; the tool can only infer from names |
| Special characters broken | PDF uses non-Unicode encoding | Re-export the source as PDF/A or re-OCR with Unicode output |
| File fails TEI validation | Project uses a custom TEI customization | Update the <schemaSpec> in the header, or validate against the base P5 schema |
Related tools
Frequently asked questions
What does the PDF to TEI XML tool do?
What is TEI?
Is the tool free?
Does it upload my PDF to a server?
How does the tool detect headers and paragraphs?
Are page breaks encoded?
Can I add a facsimile pointer?
Is the TEI output valid against the P5 schema?
Does it preserve bold, italic and underline?
Does it work on scanned PDFs?
What is the TEI header for?
Can I use the output in TEI tools?
Does it work on mobile?
Ready to encode your PDF as TEI?
Convert PDF to TEI P5 XML — free, private, no signup.
Generate TEI XML now