https://txtfetch.com/docs/citations/
Can my app cite the page?
Yes, for PDFs. Page numbers come back only on format=json, with no coordinates. Here is what each format gives you.
The short answer
Your app can cite a PDF page. It cannot do more than that. Read the limits first.
- Only format=json carries a page. The format=text and format=markdown bodies have no page marks. Ask for json when you need a page.
- Only some formats have a page. A PDF has pages. Excel, PowerPoint, Word, HTML, email and images come back with page null.
- bbox is always null. The standard tier returns no coordinates. You can link to a page. You cannot draw a highlight box.
- The premium tier sets page to null. Premium elements all carry page null. Only metadata.pages, the page count, is set.
Inside those limits, the path is short. Request format=json. Read the page on each element. Keep it as chunk metadata.
What page holds, per format
We ran each format through Tika 3.3.1 and the API's own JSON renderer. The table shows what we saw.
| Format | page | Cite instead | Source |
|---|---|---|---|
| PDF with a text layer | 1, 2, 3 … (the page number) | The page number | Tika 3.3.1 run, then renderJsonmarketing/test/fixtures/citations/README.md(accessed 2026-10-01) |
| Scanned PDF | 1, 2, 3 … (the page number) | The page number. We measured one page. Test a longer scan. | Tika 3.3.1 run, then renderJsonmarketing/test/fixtures/citations/README.md(accessed 2026-10-01) |
| Excel (.xlsx) | null | The sheet name. It comes back as a heading before each table. | Tika 3.3.1 run, then renderJsonmarketing/test/fixtures/citations/README.md(accessed 2026-10-01) |
| PowerPoint (.pptx) | null | The file name. Slide titles come back as plain paragraphs, with no slide boundary. Export to PDF for one page per slide. | Tika 3.3.1 run, then renderJsonmarketing/test/fixtures/citations/README.md(accessed 2026-10-01) |
| Word (.docx) | null | The nearest heading | Tika 3.3.1 run, then renderJsonmarketing/test/fixtures/citations/README.md(accessed 2026-10-01) |
| Web page (.html) | null | The nearest heading, plus the URL | Tika 3.3.1 run, then renderJsonmarketing/test/fixtures/citations/README.md(accessed 2026-10-01) |
| Email (.eml) | null | The subject and date, from your own mail store | Tika 3.3.1 run, then renderJsonmarketing/test/fixtures/citations/README.md(accessed 2026-10-01) |
| Image (.png) | null | The file name | Tika 3.3.1 run, then renderJsonmarketing/test/fixtures/citations/README.md(accessed 2026-10-01) |
Keep the page through chunking
A chunker usually joins many elements. Keep the first and last page of those elements. A chunk can then span two pages and still cite both.
This function has no network calls. It skips empty elements. Tika emits an empty paragraph at the edge of each PDF page. For a file with no pages, it keeps the last heading instead.
def chunk(elements, max_chars=1200):
chunks, current, heading = [], None, None
for el in elements:
text = el["text"].strip()
if not text:
continue
if el["type"] == "heading":
heading = text
if current and len(current["text"]) + len(text) > max_chars:
chunks.append(current)
current = None
if current is None:
current = {"text": "", "page_start": None, "page_end": None, "heading": heading}
current["text"] += ("\n\n" if current["text"] else "") + text
if el["page"] is not None:
if current["page_start"] is None:
current["page_start"] = el["page"]
current["page_end"] = el["page"]
if current:
chunks.append(current)
return chunksWe ran it on real output. Each line below is one chunk.
three-pages.json (a 3-page PDF), max_chars=60
page_start 1, page_end 2 page_start 2, page_end 3 page_start 3, page_end 3
page.json (an HTML file), max_chars=60
page_start None, page_end None, heading Overview page_start None, page_end None, heading Pricing
Some stores take only strings, numbers, booleans and lists of strings as metadata. Leave a null page out of the record. See the per-store limits.
Link to the page
A PDF link can open on a given page. Add #page=N to the URL. The first page is 1.
https://example.com/contracts/msa.pdf#page=12
RFC 8118, section 3: the page parameter defines this parameter (accessed 2026-10-01). Browsers differ in how they treat it. Test the viewers your users have.
Word, web pages and email
These files have no page in the data. We measured page null for each one. Cite the nearest heading, and keep the file name or URL beside it.
A Word file has no fixed pages. It stores only a hint of where the last save put each break (ISO/IEC 29500-1: lastRenderedPageBreak, accessed 2026-10-01). Our Word fixture had an explicit page break and still returned page null.
If you need a Word page, export the file to PDF first. The page then reflects that export. See PDF extraction.
Frequently asked questions
- Can my RAG app cite the page an answer came from?
- Yes, for a PDF. Ask for format=json. Each element has a page number. Store the first and last page on each chunk. Word, Excel, PowerPoint, web pages, email and images return page null.
- Can I highlight the passage on the page?
- No. The bbox field is always null on the standard tier, so no coordinates come back. You can link to the page. You cannot draw a box.
- Why does my Word file have no page numbers?
- A Word file has no fixed pages. It stores only a hint of where the last save put each break. We measured page null, even with an explicit page break. Cite the nearest heading.
- Do format=text and format=markdown carry page marks?
- No. Neither body has a page marker. Send the same request with format=json when you need the page.
Watch it run, then take a key.
The playground replays a real recorded response for every sample document.
Open the playground →