docs: def render_debug_img(
      file_name,
      page_num,
      elems,
      nodes=[],
      scaler=1,
      print_segments=False,
      print_curves=True,
      print_table_bbox=True,
      print_text_as_rect=True,
  ):
      """
      Shows an image rendering of the pdf page along with debugging
      info printed
      """
      # For debugging show the boolean pixels in black white grayscale
      height = scaler * int(elems.layout.height)
      width = scaler * int(elems.layout.width)
      debug_img, draw = create_img((0, 0, width, height))
      font = lazy_load_font()
      large_font = lazy_load_font(24)
  
      if print_curves:
          for i, c in enumerate(elems.curves):
              if len(c.pts) > 1:
                  draw.polygon(c.pts, outline=blue)
              draw.rectangle(c.bbox, fill=blue)
              # for fig in elems.figures:
              #     draw.rectangle(fig.bbox, fill = blue)
  
      for i, m in enumerate(elems.mentions):
          if isinstance(m, LTAnno):
              continue
          if print_text_as_rect:
              fill = "pink" if hasattr(m, "feats") and m.feats["is_cell"] else green
              #             fill = green
              draw.rectangle(m.bbox, fill=fill)
              # draw.text(center(m.bbox), str(i), black, font = font) # Draw id
              draw.text(
                  m.bbox[:2], m.get_text(), black, font=font
              )  # Draw mention content
          else:
              draw.text(m.bbox[:2], m.get_text(), "black", font=font)
  
      if print_segments:
          # draw skeleton for all segments
          for i, s in enumerate(elems.segments):
              draw.line(s.bbox, fill="black")
  
      if print_table_bbox:
          for node in nodes:
              is_table = node.is_table()
              color = "red" if is_table else "green"
              draw.rectangle(node.bbox, outline=color)
              if is_table:
                  # text = 'Borderless' if node.is_borderless() else 'Bordered'
                  text = "Table"
                  draw.rectangle(node.bbox, outline=color)
                  draw.text(node.bbox[:2], text, red, font=large_font)
  
      # Water mark with file name so we can identify among multiple images
      if file_name and page_num is not None:
          water_mark = (
              file_name + ":page " + str(page_num + 1) + "@%dx%d" % (width, height)
          )
          draw.text((10, 10), water_mark, black, font=font)
      debug_img.show()
      return debug_img