code: def exec_hocr_to_ocr_pdf(
      context: PdfContext, executor: Executor
  ) -> Sequence[str]:
      """Convert hOCR files to OCR PDF."""
      # Run exec_page_sync on every page
      options = context.options
      max_workers = min(len(context.pdfinfo), options.jobs)
      if max_workers > 1:
          log.info(
              "Continue processing %d pages concurrently", max_workers
          )
  
      ocrgraft = OcrGrafter(context)
  
      def graft_page(result: HOCRResult, pbar: ProgressBar):
          """Graft text only PDF on to main PDF's page."""
          try:
              set_thread_pageno(result.pageno + 1)
              pbar.update()
              ocrgraft.graft_page(
                  pageno=result.pageno,
                  image=result.pdf_page_from_image,
                  textpdf=result.textpdf,
                  autorotate_correction=result.orientation_correction,
              )
              pbar.update()
          finally:
              set_thread_pageno(None)
  
      executor(
          use_threads=options.use_threads,
          max_workers=max_workers,
          progress_kwargs=dict(
              total=(2 * len(context.pdfinfo)),
              desc="Grafting hOCR to PDF",
              unit="page",
              unit_scale=0.5,
              disable=not options.progress_bar,
          ),
          worker_initializer=partial(
              worker_init, PIL.Image.MAX_IMAGE_PIXELS
          ),
          task=_exec_hocrtransform_sync,
          task_arguments=context.get_page_context_args(),
          task_finished=graft_page,
      )
  
      pdf = ocrgraft.finalize()
      messages: Sequence[str] = []
      if options.output_type != "none":
          # PDF/A and metadata
          log.info("Postprocessing...")
          pdf, messages = postprocess(pdf, context, executor)
  
          # Copy PDF file to destination (we don't know the input PDF file name)
          copy_final(pdf, options.output_file, None)
      return messages
  
file_path: OCRmyPDF/src/ocrmypdf/_pipelines/hocr_to_ocr_pdf.py
imports: from __future__ import annotations
  import argparse
  import logging
  import logging.handlers
  from collections.abc import Sequence
  from functools import partial
  import PIL
  from ocrmypdf._concurrent import Executor
  from ocrmypdf._graft import OcrGrafter
  from ocrmypdf._jobcontext import PageContext, PdfContext
  from ocrmypdf._pipeline import copy_final, get_pdfinfo, render_hocr_page
  from ocrmypdf._pipelines._common import HOCRResult, manage_work_folder, postprocess, report_output_pdf, set_thread_pageno, setup_pipeline, worker_init
  from ocrmypdf._plugin_manager import OcrmypdfPluginManager
  from ocrmypdf._progressbar import ProgressBar
  from ocrmypdf.exceptions import ExitCode
label_desc: Use image node_id 2 for calling a global function with example usage: exec_hocr_to_ocr_pdf(context, executor) and returns: messages