Skip to content

Convert

rtflite.convert

LibreOfficeConverter

LibreOffice-based document converter.

__init__(executable_path=None)

Initialize converter with optional executable path.

_convert_single_file(input_file, output_dir, format, overwrite)

Convert a single file using LibreOffice.

_find_executable()

Find LibreOffice executable in default locations.

_verify_version()

Verify LibreOffice version meets minimum requirement.

convert(input_files, output_dir, format='pdf', overwrite=False)

Convert RTF file(s) to specified format using LibreOffice.

Parameters:

Name Type Description Default
input_files str | Path | Sequence[str | Path]

Path to input RTF file or list of paths.

required
output_dir str | Path

Directory for output files.

required
format str

Output format ('pdf', 'docx', or 'html').

'pdf'
overwrite bool

Whether to overwrite existing output files.

False

Returns:

Type Description
Path | Sequence[Path]

Path to converted file, or list of paths for multiple files.