Back to Blog

Agent workflows

Which Page 12? Keep PDF Page Labels in Your Research Agent's Citations

Separate PDF page position, document labels and visible printed numbers. Give research agents a citation record that lets a reader locate the actual passage after extraction.

OpenAgentSkillPublished:

A research agent cites page 12 of a report. You open the twelfth page in the PDF and find the table of contents. The passage exists, but the agent and the reader are using different numbering systems.

This is a small failure with a large practical cost: the reader has to search again before checking the claim. Adding more precise prose to the answer will not repair an ambiguous location.

For teams building document-reading Skills, preserve page identity during extraction instead of asking the model to reconstruct it at the end.

Methodology and selection criteria

We reviewed W3C's PDF page-numbering technique, pypdf's reader reference and PyMuPDF's page-label interface on October 12, 2026. We selected these sources because they address navigation conventions and concrete metadata access, not because they rank extraction accuracy.

The workflow below is a proposed citation handoff. We did not process a research corpus, compare library performance or verify a real paper's findings. The numbered report is an illustrative example.

Keep three locations distinct

The W3C PDF17 technique explains why document numbering and viewer navigation should agree. Front matter can use Roman numerals, main content can restart at 1 and appendices can use prefixes. PDF page-label metadata describes numbering presented by compatible viewers.

For an agent workflow, distinguish:

FieldWhat it identifiesHow to describe uncertainty
Physical positionWhere a page occurs in this exact fileState whether the index is zero-based or the position is one-based
PDF page labelThe label returned from document metadataPreserve it as a string and record the library used
Printed numberThe visible number on the page itselfRecord whether it was visually checked, extracted or unavailable

Our recommendation is to retain all available fields rather than choose one universal page number. Do not convert labels such as “iv” or “A-12” into integers. Do not assume a metadata label was verified against the visible footer.

Compare metadata access, not parser superiority

The pypdf reader reference exposes a read-only page_labels list in document order. Its page-access documentation also makes the zero-based indexing convention explicit. This is useful when building a mapping alongside a page-by-page extraction pipeline.

PyMuPDF's Page.get_label reference documents a page label string and an empty string when no label is defined. That makes it important not to overwrite an absent label with a confident assertion about printed numbering.

Choose the interface already appropriate for your authorized document workflow unless a concrete requirement justifies another dependency. Neither interface, by itself, proves that a quoted sentence was extracted correctly. Keep library output separate from your own normalization and visual checks, and verify behavior against the version you deploy.

Build a citation record while extracting

For each retained passage, our proposed record includes the source URL or authorized file identity, a content hash, physical page position, extracted page label, visible numbering status and a nearby heading or table caption.

Bind that record to the exact document bytes. A publisher can replace a PDF at the same URL, or a teammate can insert a cover sheet. The old position should not silently be reused with the new file.

Attach the location to the extracted passage before chunking or summarization. If a chunk spans two pages, keep both locations. Flattening the entire document into one string and later guessing page breaks creates avoidable uncertainty.

The record should also state the extraction method and whether OCR was involved. This is provenance for the workflow, not a certification of text accuracy. Keep only the minimum excerpt necessary for the task and respect the document's access and redistribution conditions.

Show the reader an unambiguous locator

In an invented report with introductory pages, a useful handoff might say: “printed p. 12; PDF position 18 of 90; section: Retention policy.” Those numbers are an example of formatting, not observations about a source.

If only physical position was established, say “PDF page position 18” instead of presenting it as the document's printed page 18. If the visible number could not be checked, retain that uncertainty in the internal record and give the reader a heading or short passage locator.

A deep link may be convenient, but check it in the viewer your recipients use before relying on it. Keep the text locator beside the link so the citation remains usable when navigation behavior differs.

Do not edit the source PDF's numbering merely to simplify the agent's output. If a separate annotated copy is authorized, identify it as a derivative and preserve the original-to-copy mapping.

A small acceptance exercise

Choose a few documents you are permitted to process: one with straightforward numbering, one with Roman-numeral front matter and one with an appendix or an inserted cover.

Before extraction, manually identify a passage in each. Then ask whether a reviewer using only the generated citation can locate that passage in the same file. Record mismatches between position, metadata and printed numbering rather than forcing them into a single corrected field.

This is a proposed evaluation, not a benchmark result. A passing navigation check says that the location is usable; it does not say the passage supports the agent's interpretation. Assess that separately.

Limitations and the research handoff

Scans, missing labels, repeated numbering and replaced source files complicate the mapping. OCR can misread a footer, and metadata can disagree with the visible page. Stop short of a precise printed-page claim when the evidence is missing.

Our comparison of MarkItDown, Docling and GROBID discusses which structures a research pipeline must preserve. This guide addresses one narrower requirement: a reader must be able to return to the actual page. When evaluating research workflows in the Skill directory, include that requirement in the handoff rather than treating readable Markdown as the final result.