PdfElixide.Document.BookmarkSegment (pdf_elixide v0.23.0)

Copy Markdown View Source

One part of a document split at its bookmarks.

Returned by PdfElixide.Document.bookmark_segments/2 and PdfElixide.Editor.bookmark_segments/2, and paired with each part's bytes by PdfElixide.Editor.split_by_bookmarks/2:

  • :title — the title of the bookmark that starts the segment, or nil for the front matter: the pages before the first such bookmark.
  • :pages — the zero-based page indices the segment covers, as an inclusive range. Pass it in a list to PdfElixide.Editor.extract_page_ranges/2, as in [segment.pages].
  • :file_stem — a portable file name derived from the title, without an extension. Empty titles become "untitled", front matter becomes "front-matter", and collisions get a (2), (3) … suffix. Stems are safe on common platforms, distinct on case-insensitive file systems and at most 80 bytes.

See Splitting at bookmarks.

Summary

Types

t()

@type t() :: %PdfElixide.Document.BookmarkSegment{
  file_stem: String.t(),
  pages: Range.t(),
  title: String.t() | nil
}