code: def strip_invisible_text(pdf: Pdf, page: Page):
      stream = []
      in_text_obj = False
      render_mode = 0
      text_objects = []
  
      for operands, operator in parse_content_stream(page, ""):
          if not in_text_obj:
              if operator == Operator("BT"):
                  in_text_obj = True
                  render_mode = 0
                  text_objects.append((operands, operator))
              else:
                  stream.append((operands, operator))
          else:
              if operator == Operator("Tr"):
                  render_mode = operands[0]
              text_objects.append((operands, operator))
              if operator == Operator("ET"):
                  in_text_obj = False
                  if render_mode != 3:
                      stream.extend(text_objects)
                  text_objects.clear()
  
      content_stream = unparse_content_stream(stream)
      page.Contents = Stream(pdf, content_stream)
  
file_path: OCRmyPDF/src/ocrmypdf/_graft.py
imports: from __future__ import annotations
  import logging
  from contextlib import suppress
  from enum import Enum
  from pathlib import Path
  from pikepdf import Dictionary, Matrix, Name, Operator, Page, Pdf, PdfError, Stream, parse_content_stream, unparse_content_stream
  from ocrmypdf._jobcontext import PdfContext
label_desc: Use image node_id 3 for calling a global function with example usage: strip_invisible_text(pdf, page) without return types