PdfEx.Glyphs (pdf_ex v0.1.0)

Copy Markdown View Source

Lazy glyph projection: builds doc.glyphs (per page-object ref) and doc.uid_index ("p<page_obj_id>_g<seq>" -> {:glyph, contents_ref, show_op_index, glyph_index}).

UIDs key on the page OBJECT id, so structural edits (Phase 2) never renumber surviving pages' glyphs. Only the first /Contents stream of a page is indexed in Phase 3 (documented limitation).

Summary

Functions

Raw (decompressed) bytes of a content stream object.

Builds (and memoizes) the per-page glyph list and the uid_index on the document. Idempotent: returns the document unchanged if already indexed.

Functions

content_bytes(doc, ref)

@spec content_bytes(PdfEx.Document.t(), PdfEx.Document.ref_key()) ::
  {:ok, binary()} | {:error, any()}

Raw (decompressed) bytes of a content stream object.

index(doc)

@spec index(PdfEx.Document.t()) ::
  {:ok, PdfEx.Document.t()} | {:error, PdfEx.Error.t()}

Builds (and memoizes) the per-page glyph list and the uid_index on the document. Idempotent: returns the document unchanged if already indexed.