PDFRedlines (pdf_redlines v0.6.0)

View Source

Fast PDF redline detection and extraction via a Rust NIF (MuPDF).

This module wraps the native NIF results into Elixir structs for a stable public API.

Summary

Functions

Extract redlines from a PDF file path.

Extract redlines from PDF binary content.

Check if a PDF file contains redlines.

Check if PDF binary content contains redlines.

Functions

extract_redlines(pdf_path, opts \\ [])

@spec extract_redlines(Path.t(), keyword() | map()) ::
  {:ok, PDFRedlines.Result.t()} | {:error, term()}

Extract redlines from a PDF file path.

Options

Pass a keyword list or map to tune detection thresholds. Supported keys:

  • :red_r_min
  • :red_g_max
  • :red_b_max
  • :blue_r_max
  • :blue_g_max
  • :blue_b_min
  • :formatting_bar_height_max
  • :formatting_bar_width_min
  • :line_bar_height_max
  • :line_bar_width_min
  • :stroke_line_y_tolerance
  • :stroke_line_width_min
  • :line_break_height_ratio
  • :same_line_y_tolerance
  • :merge_x_gap_max
  • :merge_line_height_min_ratio
  • :merge_line_height_max_ratio
  • :margin_end_ratio
  • :margin_start_ratio
  • :pair_x_gap_max
  • :page_width_fallback
  • :line_height_fallback

extract_redlines_from_binary(pdf_binary, opts \\ [])

@spec extract_redlines_from_binary(binary(), keyword() | map()) ::
  {:ok, PDFRedlines.Result.t()} | {:error, term()}

Extract redlines from PDF binary content.

has_redlines?(pdf_path, opts \\ [])

@spec has_redlines?(Path.t(), keyword() | map()) ::
  {:ok, boolean()} | {:error, term()}

Check if a PDF file contains redlines.

has_redlines_from_binary?(pdf_binary, opts \\ [])

@spec has_redlines_from_binary?(binary(), keyword() | map()) ::
  {:ok, boolean()} | {:error, term()}

Check if PDF binary content contains redlines.