PdfElixide.Document.Page (pdf_elixide v0.7.0)

Copy Markdown View Source

Representation of a page of a PDF document.

Summary

Functions

Extracts the characters of the page, each with its bounding box, font metadata, and typographic placement.

Same as chars/1 but raises an error if it fails.

Returns the page's height in points.

Same as height/1 but raises an error if it fails.

Extracts the raster images of the page — photos, logos, and scanned pictures.

Same as images/1 but raises an error if it fails.

Extracts the vector paths of the page — lines, curves, rectangles, and shapes.

Same as paths/1 but raises an error if it fails.

Extracts the spans of the page, each a run of text sharing one text state.

Same as spans/1 but raises an error if it fails.

Detects the tables of the page.

Same as tables/1 but raises an error if it fails.

Extracts the text content of the page.

Same as text/1 but raises an error if it fails.

Extracts the text lines of the page, each with its bounding box and words.

Same as text_lines/1 but raises an error if it fails.

Returns the page's width in points.

Same as width/1 but raises an error if it fails.

Extracts the words of the page, each with its bounding box and font metadata.

Same as words/1 but raises an error if it fails.

Types

t()

@type t() :: %PdfElixide.Document.Page{
  doc: PdfElixide.Document.t(),
  index: non_neg_integer()
}

Functions

chars(page)

@spec chars(t()) ::
  {:ok, [PdfElixide.Document.Char.t()]} | {:error, PdfElixide.Error.t()}

Extracts the characters of the page, each with its bounding box, font metadata, and typographic placement.

chars!(page)

@spec chars!(t()) :: [PdfElixide.Document.Char.t()]

Same as chars/1 but raises an error if it fails.

height(page)

@spec height(t()) :: {:ok, float()} | {:error, PdfElixide.Error.t()}

Returns the page's height in points.

height!(page)

@spec height!(t()) :: float()

Same as height/1 but raises an error if it fails.

images(page)

@spec images(t()) ::
  {:ok, [PdfElixide.Document.Image.t()]} | {:error, PdfElixide.Error.t()}

Extracts the raster images of the page — photos, logos, and scanned pictures.

Returns {:ok, []} when the page has no images.

images!(page)

@spec images!(t()) :: [PdfElixide.Document.Image.t()]

Same as images/1 but raises an error if it fails.

paths(page)

@spec paths(t()) ::
  {:ok, [PdfElixide.Document.Path.t()]} | {:error, PdfElixide.Error.t()}

Extracts the vector paths of the page — lines, curves, rectangles, and shapes.

Returns {:ok, []} when the page has no vector graphics.

paths!(page)

@spec paths!(t()) :: [PdfElixide.Document.Path.t()]

Same as paths/1 but raises an error if it fails.

spans(page)

@spec spans(t()) ::
  {:ok, [PdfElixide.Document.Span.t()]} | {:error, PdfElixide.Error.t()}

Extracts the spans of the page, each a run of text sharing one text state.

spans!(page)

@spec spans!(t()) :: [PdfElixide.Document.Span.t()]

Same as spans/1 but raises an error if it fails.

tables(page)

@spec tables(t()) ::
  {:ok, [PdfElixide.Document.Table.t()]} | {:error, PdfElixide.Error.t()}

Detects the tables of the page.

Returns {:ok, []} when the page has no detectable table.

tables!(page)

@spec tables!(t()) :: [PdfElixide.Document.Table.t()]

Same as tables/1 but raises an error if it fails.

text(page)

@spec text(t()) :: {:ok, binary()} | {:error, PdfElixide.Error.t()}

Extracts the text content of the page.

text!(page)

@spec text!(t()) :: binary()

Same as text/1 but raises an error if it fails.

text_lines(page)

@spec text_lines(t()) ::
  {:ok, [PdfElixide.Document.TextLine.t()]} | {:error, PdfElixide.Error.t()}

Extracts the text lines of the page, each with its bounding box and words.

text_lines!(page)

@spec text_lines!(t()) :: [PdfElixide.Document.TextLine.t()]

Same as text_lines/1 but raises an error if it fails.

width(page)

@spec width(t()) :: {:ok, float()} | {:error, PdfElixide.Error.t()}

Returns the page's width in points.

width!(page)

@spec width!(t()) :: float()

Same as width/1 but raises an error if it fails.

words(page)

@spec words(t()) ::
  {:ok, [PdfElixide.Document.Word.t()]} | {:error, PdfElixide.Error.t()}

Extracts the words of the page, each with its bounding box and font metadata.

words!(page)

@spec words!(t()) :: [PdfElixide.Document.Word.t()]

Same as words/1 but raises an error if it fails.