Low-level API¶
Lower-level components and utilities for advanced users who need fine-grained control.
Configuration¶
Core configuration and constants.
Core RTF constants for measurements, formatting, and control codes.
DEFAULT_BORDER_WIDTH = 15
class-attribute
instance-attribute
¶
Default border width in twips.
DEFAULT_CELL_HEIGHT = 0.15
class-attribute
instance-attribute
¶
Default cell height in inches.
DEFAULT_FONT_SIZE = 9
class-attribute
instance-attribute
¶
Default font size in points.
DEFAULT_SPACE_AFTER = 15
class-attribute
instance-attribute
¶
Default space after paragraph in points.
DEFAULT_SPACE_BEFORE = 15
class-attribute
instance-attribute
¶
Default space before paragraph in points.
LINE_SPACING_FACTOR = 240
class-attribute
instance-attribute
¶
Factor used for line spacing calculations in RTF.
POINTS_PER_INCH = 72
class-attribute
instance-attribute
¶
Number of points in one inch.
TWIPS_PER_INCH = 1440
class-attribute
instance-attribute
¶
Number of twips in one inch. RTF uses twips as the base unit.
Control
¶
RTF control word constants.
Figure Utilities¶
Utilities for reading and processing figures.
Read image files and return their binary data with format information.
This function reads image files from disk and prepares them for embedding in RTF documents. It supports PNG, JPEG, and EMF formats.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_paths
|
str | Path | list[str | Path]
|
Single file path or list of file paths to image files |
required |
Returns:
Type | Description |
---|---|
tuple[list[bytes], list[str]]
|
Tuple of (figure_data, figure_formats) where: - figure_data: List of image binary data as bytes - figure_formats: List of format strings ('png', 'jpeg', 'emf') |
Raises:
Type | Description |
---|---|
FileNotFoundError
|
If any image file cannot be found |
ValueError
|
If image format is not supported |