Receive the document (PDF or image) and OCR engine preference.
Load the document and convert PDF pages to images if needed.
Initialize the specified OCR engine (RapidOCR or SiliconFlow API).
Perform OCR on each image.
Concatenate the extracted text.
Return the extracted text, page count, and engine used.
Handle any errors during processing.