Class PageAnchoring

java.lang.Object
org.apache.tika.metadata.PageAnchoring

public final class PageAnchoring extends Object
Helpers for tagging an embedded resource's metadata with the pages or sheets of its parent document on which it appears. Centralised so every paginated/sheeted parser (HSLF/XSLF for PowerPoint, OpenDocumentParser for ODP, HSSF/XSSF for Excel, PDF, ...) encodes the same convention identically.

Convention:

  • indices == null: caller does not know the resource's anchoring — both single- and sequence-valued properties are left unset.
  • indices.isEmpty(): the resource is known to be present in the container but referenced from no page/sheet — the sequence property is set to a single-element array containing the sentinel value (see TikaPagedText.UNLINKED_PAGE and Office.UNLINKED_SHEET).
  • indices.size() == 1: both the single-valued and the sequence-valued property are set, the sequence carrying the one index as its only element. Consumers that only inspect the single-valued property still see the right answer.
  • indices.size() > 1: only the sequence-valued property is set; the single-valued property is cleared, because no single index would be meaningful.

This class only mutates the metadata it is handed — it is the caller's job to compute the index set (e.g. by pre-scanning a slide file for picture references before the embedded-resource emission).