View Source Idmlx.Components.Spreads behaviour (idmlx v0.2.1)

Provides functionality for parsing and working with InDesign spreads.

This module handles:

  • Parsing spreads from IDMS/IDML files
  • Extracting geometric bounds
  • Processing page items
  • Managing spread collections

Spread Processing

Spreads are processed by:

  1. Reading spread files from disk
  2. Parsing XML content
  3. Calculating geometric bounds
  4. Processing page items with their layers and stories
  5. Assembling the final spread structure

File Support

Supports both:

  • IDMS (InDesign Markup Snippet) files
  • Individual spread files from IDML packages

Summary

Functions

Gets all spreads from a directory of spread files.

Callbacks

get_spreads(t)

@callback get_spreads(String.t()) :: [Idmlx.Components.Spread.t()]

parse_spread(t, list)

@callback parse_spread(String.t(), [Idmlx.Components.Story.t()]) ::
  Idmlx.Components.Spread.t()

Functions

get_spreads(path \\ "Spreads")

@spec get_spreads(String.t()) :: [Idmlx.Components.Spread.t()]

Gets all spreads from a directory of spread files.

Parameters

  • path: Path to the directory containing spread files (defaults to "Spreads")

Returns

List of parsed Spread structs

Examples

iex> Idmlx.Components.Spreads.get_spreads("./example/Spreads")
[%Spread{geometric_bounds: [0, 0, 841.89, 595.28], items: [...]}, ...]

parse_spread(file_path, layers \\ [], stories \\ [])

@spec parse_spread(String.t(), list(), list()) :: Idmlx.Components.Spread.t()

Parses a spread from a file.

Handles both IDMS files and individual spread files from IDML packages.

Parameters

  • file_path: Path to the spread file
  • layers: Optional list of layers
  • stories: Optional list of stories

Returns

A parsed Spread struct

Examples

iex> Idmlx.Components.Spreads.parse_spread("spread.idms")
%Spread{
  geometric_bounds: [0, 0, 841.89, 595.28],
  items: [%TextFrame{}, %Rectangle{}]
}