Skip to main contentClasses
OsPath
Represents a filesystem path with type and overwrite options.
Attributes:
path (str): The filesystem path.
type (Literal[“file”, “directory”, “outputfile”]): The type of path, defaults to “file”.
overwrite (bool): Whether to overwrite an existing file, defaults to False.
Methods
read_file
Reads the file content based on its type.
Returns:
str | bytes | None: The content of the file as string (for text) or bytes (for PDF), or None if not readable.
write_file
Writes content to the output file if overwrite is enabled.
Args:
content (bytes): The content to write.
Raises:
FileExistsError: If the file exists and overwrite is False.
MultipleConversion
Represents a batch conversion process for multiple files to PDF format.
Attributes:
input_files (list[OsPath]): List of input file paths to be converted.
output_files (list[OsPath]): List of output file paths for the converted PDFs.