JavaScript: Preserving the TOC through OCR – a shorter solution

The latest version of the OCR engine actually retains the table of contents. Do you use Intel or Apple Silicon Macs?