def display_bounding_boxes_within_notebook(<EOL>page_num, extractor, blocks, alternatecolors=False, color=Color("<STR_LIT>")<EOL>):
elems = extractor.elems[page_num]<EOL>page_width, page_height = int(elems.layout.width), int(elems.layout.height)<EOL>img = pdf_to_img(extractor.pdf_file, page_num, page_width, page_height)<EOL>draw = Drawing()<EOL>draw.fill_color = Color("<STR_LIT>")<EOL>draw.stroke_color = color<EOL>for block in blocks:<EOL><INDENT>top, left, bottom, right = block[-<NUM_LIT:4>:]<EOL>if alternatecolors:<EOL><INDENT>draw.stroke_color = Color(<EOL>"<STR_LIT>".format(<EOL>str(np.random.randint(<NUM_LIT:255>)),<EOL>str(np.random.randint(<NUM_LIT:255>)),<EOL>str(np.random.randint(<NUM_LIT:255>)),<EOL>)<EOL>)<EOL><DEDENT>draw.rectangle(<EOL>left=float(left), top=float(top), right=float(right), bottom=float(bottom)<EOL>)<EOL>draw(img)<EOL><DEDENT>return img<EOL>
Displays each of the bounding boxes passed in 'boxes' on an image of the pdf
pointed to by pdf_file
boxes is a list of 5-tuples (page, top, left, bottom, right)