https://txtfetch.com/docs/headers-and-notes/
Where do headers, footnotes and comments go?
They come back, in the same text as the body. txtfetch does not strip them. Here is where each one lands, by format.
The short answer
txtfetch does not strip headers, footers, footnotes or comments. All of them come back as plain text. You must remove what you do not want.
A Word header and a Word footer come back once for each section, not once for each page. A PDF header and a PDF page number come back on every page.
A Word footnote body follows its paragraph. Its mark becomes the literal text [footnoteRef:1]. An endnote does the same with [endnoteRef:1].
A Word comment follows its paragraph as Comment by Reviewer Name: …. The reviewer's name is in the text. A PDF sticky note, a PowerPoint comment and an Excel cell comment also come back with the name. Only an OpenDocument comment comes back without one.
The engine is tika-server-standard 3.3.1.
Source: terraform/lambda-layers/build/versions.env (versions.env: TIKA_VERSION), accessed 2026-10-20.
What comes back, case by case
We built one small file for each format. Each part holds a marker sentence, so you can see which part came back and where. We sent each file to the production API. Every row shows its source. The inputs and the raw responses are in the repo.
| Input | What comes back | Source |
|---|---|---|
| A Word file with a header, footer, footnote, endnote and comment, in two sections | Both headers come back once each. The header of the last section comes first, at the top. The header and the footer of section one come after the body of section one, where that section ends. A footnote or endnote body follows its paragraph. Its mark becomes the literal text [footnoteRef:1] or [endnoteRef:1]. The comment follows its paragraph after a tab, as Comment by, the reviewer's name, a colon and the comment. | Production API probe: POST /v1/extract accessed 2026-10-20 |
| The same Word file as Markdown | The same order and the same words. The marks gain backslashes: \[footnoteRef:1\]. The tab before the comment becomes a space. The json output keeps the same order, one paragraph per element, with the comment in the paragraph it belongs to. | Production API probe: POST /v1/extract accessed 2026-10-20 |
| An OpenDocument text file with a header, footer, footnote and comment | The footnote number and body join the paragraph that holds the footnote. The comment text comes back inline, with no reviewer name. The header and the footer come last, after all the body text. | Production API probe: POST /v1/extract accessed 2026-10-20 |
| A two-page PDF with a running header, a page number and a sticky note | The header and the page number come back on every page, as plain lines. The sticky note comes back after the text of page 1. The author name comes first, on its own line, then the note. In the json output each line carries its page number. | Production API probe: POST /v1/extract accessed 2026-10-20 |
| A PowerPoint slide with a footer and a comment | The footer text comes back after the slide title. The comment comes back after the slide text, as the reviewer's name, the initials in brackets, a hyphen and the comment. | Production API probe: POST /v1/extract accessed 2026-10-20 |
| An Excel sheet with a page header, a page footer and a cell comment | The comment comes back inside its cell, after the cell text: the reviewer's name, a colon and the comment. The page header and the page footer come last, after the cells, each on its own line. | Production API probe: POST /v1/extract accessed 2026-10-20 |
| The same Excel sheet as Markdown | The comment stays inside its table cell. The page header and the page footer follow the table as two paragraphs. | Production API probe: POST /v1/extract accessed 2026-10-20 |
Real output
Each block is the full response body, as the API sent it. In the JSON, \n is a line break inside the text, and \t is a tab.
A Word file with a header, footer, footnote, endnote and comment, in two sections
In
notes.docx
Out
{"status":"success","extracted_text":"HEADER two for section two\nBody one.\nBody two has a footnote.[footnoteRef:1]\nFOOTNOTE text here.\n\nBody three has a comment.\tComment by Reviewer Name: COMMENT body here.\nBody four has an endnote.[endnoteRef:1]\nENDNOTE text here.\n\nHEADER one Acme Confidential\n\nFOOTER one text\nBody five is in section two.\n","metadata":{"content_type":"application/vnd.openxmlformats-officedocument.wordprocessingml.document","bytes":3369,"chars":304,"ocr":false}}The same Word file as Markdown
In
notes.docx (format=markdown)
Out
{"status":"success","markdown":"HEADER two for section two\n\nBody one.\n\nBody two has a footnote.\\[footnoteRef:1\\]\n\nFOOTNOTE text here.\n\nBody three has a comment. Comment by Reviewer Name: COMMENT body here.\n\nBody four has an endnote.\\[endnoteRef:1\\]\n\nENDNOTE text here.\n\nHEADER one Acme Confidential\n\nFOOTER one text\n\nBody five is in section two.\n","metadata":{"content_type":"application/vnd.openxmlformats-officedocument.wordprocessingml.document","bytes":3369,"ocr":false,"chars":314,"format":"markdown","tier":"standard","pages":null,"vlm":false}}An OpenDocument text file with a header, footer, footnote and comment
In
notes.odt
Out
{"status":"success","extracted_text":"Body one.\nBody two has a footnote.1 FOOTNOTE text here. \nBody three has a comment. COMMENT body here. \nHEADER Acme Confidential\nFOOTER Page footer text\n","metadata":{"content_type":"application/vnd.oasis.opendocument.text","bytes":1299,"chars":152,"ocr":false}}A two-page PDF with a running header, a page number and a sticky note
In
notes.pdf
Out
{"status":"success","extracted_text":"\nHEADER Acme Confidential\n\nBody one on page one.\n\nPage 1\n\nReviewer Name\nCOMMENT body here.\n\n\n\nHEADER Acme Confidential\n\nBody two on page two.\n\nPage 2\n\n\n","metadata":{"content_type":"application/pdf","bytes":2066,"chars":152,"ocr":false}}A PowerPoint slide with a footer and a comment
In
notes.pptx
Out
{"status":"success","extracted_text":"Slide title text\nFOOTER Slide footer text\n\n\nReviewer Name (RN) - COMMENT body here.\n\n\n\n\n","metadata":{"content_type":"application/vnd.openxmlformats-officedocument.presentationml.presentation","bytes":28963,"chars":88,"ocr":false}}An Excel sheet with a page header, a page footer and a cell comment
In
notes.xlsx
Out
{"status":"success","extracted_text":"Sheet\n\tCell one text\nReviewer Name: COMMENT body here.\tCell two text\n\nHEADER Acme Confidential\t\n\nFOOTER Page footer text\t\n\n\n","metadata":{"content_type":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","bytes":6280,"chars":124,"ocr":false}}The same Excel sheet as Markdown
In
notes.xlsx (format=markdown)
Out
{"status":"success","markdown":"# Sheet\n\n| Cell one text Reviewer Name: COMMENT body here. | Cell two text |\n| --- | --- |\n\nHEADER Acme Confidential\n\nFOOTER Page footer text\n","metadata":{"content_type":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","bytes":6280,"ocr":false,"chars":142,"format":"markdown","tier":"standard","pages":null,"vlm":false}}What this means for your pipeline
These parts land in your chunks. A header, a footer or a comment can end up inside a chunk next to body text that has nothing to do with it. Decide what to keep before you split the text.
Footnote marks stay in the text as [footnoteRef:N]. Remove them, or match each mark to its note. The first snippet below removes them.
Comments are the sensitive part. A Word comment puts the reviewer's name in the text. The metadata object holds no document properties. Remove the comments before you index a file that others have reviewed. The second snippet does it. What personal data txtfetch returns lists the other places a name can hide.
A PDF repeats its header and page number on every page. The filter for that is on Headers, footers and page numbers in every chunk. The snippets here do not repeat it.
How to remove them yourself
Run each snippet next to your txtfetch call. Each snippet ran on the saved response named under it.
Strip the footnote and endnote marks
The marks are literal text. A short regex removes them and keeps the note bodies.
Python, run on responses.json
import json
import re
with open("responses.json", encoding="utf-8") as f:
text = json.loads(json.load(f)["notes-docx"]["text"])["extracted_text"]
# "[footnoteRef:1]" and "[endnoteRef:1]" are marks, not words.
cleaned = re.sub(r"\[(?:foot|end)noteRef:\d+\]", "", text)
print(cleaned)It printed
HEADER two for section two Body one. Body two has a footnote. FOOTNOTE text here. Body three has a comment. Comment by Reviewer Name: COMMENT body here. Body four has an endnote. ENDNOTE text here. HEADER one Acme Confidential FOOTER one text Body five is in section two.
Split the comments off a Word response
Each comment follows its paragraph after a tab. Collect the comments, then remove them from the body. Use the plain text output. The markdown output has a space where the tab was.
Python, run on responses.json
import json
import re
with open("responses.json", encoding="utf-8") as f:
text = json.loads(json.load(f)["notes-docx"]["text"])["extracted_text"]
# A comment follows its paragraph after a tab: "<tab>Comment by <author>: <text>".
COMMENT = re.compile(r"\tComment by ([^:\n]+): ([^\n]*)")
for author, body in COMMENT.findall(text):
print("comment:", author, "|", body)
print(COMMENT.sub("", text))It printed
comment: Reviewer Name | COMMENT body here. HEADER two for section two Body one. Body two has a footnote.[footnoteRef:1] FOOTNOTE text here. Body three has a comment. Body four has an endnote.[endnoteRef:1] ENDNOTE text here. HEADER one Acme Confidential FOOTER one text Body five is in section two.
What we did not test
We tested uploaded files, and one example of each part. We did not test a page that txtfetch fetches from a URL. We did not test the legacy .doc, .xls and .ppt formats. We tested tracked changes on a separate page. We did not test a first-page header, an even-page header, or a text box in a header. We did not test a comment with several paragraphs, or a reply to a comment. We make no claim about them.
Read Tracked changes, the Office page and Attachments and archives for the rest of each format.
Frequently asked questions
- Does txtfetch remove headers and footers from a Word file?
- No. In our probe the header text and the footer text of a Word file came back as plain lines. A Word header came back once for each section, not once for each page. Remove them on your side if you do not want them.
- Where does a footnote come back?
- In a Word file, the footnote body follows the paragraph that holds its mark. The mark itself becomes the literal text [footnoteRef:1]. An endnote does the same with [endnoteRef:1]. In an OpenDocument file the footnote number and body join the paragraph.
- Do Word comments come back?
- Yes. Each comment follows its paragraph after a tab, as Comment by, the reviewer's name, a colon and the comment. The reviewer's name is in the text. Remove the comments before you index a file, if the names or the notes are private.
- Do comments come back from ODT, PDF, PowerPoint and Excel files?
- Yes, in our probe. A PDF sticky note came back with the author name on its own line, before the note. A PowerPoint comment came back with the name and the initials. An Excel cell comment came back with the name, inside its cell. An OpenDocument comment came back without the author name, although the file holds one.
- Does a PDF header come back on every page?
- Yes. A header or a page number drawn on each page comes back once for each page, as a plain line. See /fixes/headers-and-footers-in-every-chunk for a filter.
- Does txtfetch return the document properties, such as the author?
- No. The metadata object holds no document properties. A comment is different. It is part of the text, so a reviewer's name can come back inside it.
Watch it run, then take a key.
The playground replays a real recorded response for every sample document.
Open the playground →