code: def filter_pdf_page(
      page: PageContext, image_filename: Path, output_pdf: Path
  ) -> Path:
      """Called to convert a filtered whole page image into a PDF.
  
      A whole page image is only produced when preprocessing command line arguments
      are issued or when ``--force-ocr`` is issued. If no whole page is image is
      produced for a given page, this function will not be called. This is not
      the image that will be shown to OCR. The whole page image is filtered in
      the hook above, ``filter_page_image``, then this function is called for
      PDF conversion.
  
      This function will only be called when OCRmyPDF runs in a mode such as
      "force OCR" mode where rasterizing of all content is performed.
  
      Clever things could be done at this stage such as segmenting the page image into
      color regions or vector equivalents.
  
      The provider of the hook implementation is responsible for ensuring that the
      OCR text layer is aligned with the PDF produced here, or text misalignment
      will result.
  
      Currently this function must produce a single page PDF or the pipeline will
      fail.  If the intent is to remove the PDF, then create a single page empty
      PDF.
  
      Args:
          page: Context for this page.
          image_filename: Filename of the input image used to create output_pdf,
              for "reference" if recreating the output_pdf entirely.
          output_pdf: The previous created output_pdf.
  
      Returns:
          output_pdf
  
      Note:
          This hook will be called from child processes. Modifying global state
          will not affect the main process or other child processes.
  
      Note:
          This is a :ref:`firstresult hook<firstresult>`.
      """
  
imports: from __future__ import annotations
  from abc import ABC, abstractmethod
  from argparse import ArgumentParser, Namespace
  from collections.abc import Sequence, Set
  from logging import Handler
  from pathlib import Path
  from typing import TYPE_CHECKING, NamedTuple
  import pluggy
  from ocrmypdf import Executor, PdfContext
  from ocrmypdf._progressbar import ProgressBar
  from ocrmypdf.helpers import Resolution
label_desc: Use image node_id 11 for calling a global function with example usage: filter_pdf_page(page, image_filename, output_pdf) without return types