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:
- Reading spread files from disk
- Parsing XML content
- Calculating geometric bounds
- Processing page items with their layers and stories
- Assembling the final spread structure
File Support
Supports both:
- IDMS (InDesign Markup Snippet) files
- Individual spread files from IDML packages
Summary
Callbacks
@callback get_spreads(String.t()) :: [Idmlx.Components.Spread.t()]
@callback parse_spread(String.t(), [Idmlx.Components.Story.t()]) :: Idmlx.Components.Spread.t()
Functions
@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: [...]}, ...]
@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{}]
}