def render_debug_img(<EOL>file_name,<EOL>page_num,<EOL>elems,<EOL>nodes=[],<EOL>scaler=<NUM_LIT:1>,<EOL>print_segments=False,<EOL>print_curves=True,<EOL>print_table_bbox=True,<EOL>print_text_as_rect=True,<EOL>):
<EOL>height = scaler * int(elems.layout.height)<EOL>width = scaler * int(elems.layout.width)<EOL>debug_img, draw = create_img((<NUM_LIT:0>, <NUM_LIT:0>, width, height))<EOL>font = lazy_load_font()<EOL>large_font = lazy_load_font(<NUM_LIT>)<EOL>if print_curves:<EOL><INDENT>for i, c in enumerate(elems.curves):<EOL><INDENT>if len(c.pts) > <NUM_LIT:1>:<EOL><INDENT>draw.polygon(c.pts, outline=blue)<EOL><DEDENT>draw.rectangle(c.bbox, fill=blue)<EOL><DEDENT><DEDENT>for i, m in enumerate(elems.mentions):<EOL><INDENT>if isinstance(m, LTAnno):<EOL><INDENT>continue<EOL><DEDENT>if print_text_as_rect:<EOL><INDENT>fill = "<STR_LIT>" if hasattr(m, "<STR_LIT>") and m.feats["<STR_LIT>"] else green<EOL>draw.rectangle(m.bbox, fill=fill)<EOL>draw.text(<EOL>m.bbox[:<NUM_LIT:2>], m.get_text(), black, font=font<EOL>)  <EOL><DEDENT>else:<EOL><INDENT>draw.text(m.bbox[:<NUM_LIT:2>], m.get_text(), "<STR_LIT>", font=font)<EOL><DEDENT><DEDENT>if print_segments:<EOL><INDENT>for i, s in enumerate(elems.segments):<EOL><INDENT>draw.line(s.bbox, fill="<STR_LIT>")<EOL><DEDENT><DEDENT>if print_table_bbox:<EOL><INDENT>for node in nodes:<EOL><INDENT>is_table = node.is_table()<EOL>color = "<STR_LIT>" if is_table else "<STR_LIT>"<EOL>draw.rectangle(node.bbox, outline=color)<EOL>if is_table:<EOL><INDENT>text = "<STR_LIT>"<EOL>draw.rectangle(node.bbox, outline=color)<EOL>draw.text(node.bbox[:<NUM_LIT:2>], text, red, font=large_font)<EOL><DEDENT><DEDENT><DEDENT>if file_name and page_num is not None:<EOL><INDENT>water_mark = (<EOL>file_name + "<STR_LIT>" + str(page_num + <NUM_LIT:1>) + "<STR_LIT>" % (width, height)<EOL>)<EOL>draw.text((<NUM_LIT:10>, <NUM_LIT:10>), water_mark, black, font=font)<EOL><DEDENT>debug_img.show()<EOL>return debug_img<EOL>
Shows an image rendering of the pdf page along with debugging
info printed