def display_boxes(self, tree, html_path, filename_prefix, alternate_colors=False):
imgs = []<EOL>colors = {<EOL>"<STR_LIT>": Color("<STR_LIT>"),<EOL>"<STR_LIT>": Color("<STR_LIT>"),<EOL>"<STR_LIT>": Color("<STR_LIT>"),<EOL>"<STR_LIT>": Color("<STR_LIT>"),<EOL>"<STR_LIT:list>": Color("<STR_LIT>"),<EOL>"<STR_LIT>": Color("<STR_LIT>"),<EOL>"<STR_LIT>": Color("<STR_LIT>"),<EOL>"<STR_LIT>": Color("<STR_LIT>"),<EOL>}<EOL>for i, page_num in enumerate(tree.keys()):<EOL><INDENT>img = self.pdf_to_img(page_num)<EOL>draw = Drawing()<EOL>draw.fill_color = Color("<STR_LIT>")<EOL>for clust in tree[page_num]:<EOL><INDENT>for (pnum, pwidth, pheight, top, left, bottom, right) in tree[page_num][<EOL>clust<EOL>]:<EOL><INDENT>draw.stroke_color = colors[clust]<EOL>draw.rectangle(left=left, top=top, right=right, bottom=bottom)<EOL>draw.push()<EOL>draw.font_size = <NUM_LIT:20><EOL>draw.font_weight = <NUM_LIT:10><EOL>draw.fill_color = colors[clust]<EOL>if int(left) > <NUM_LIT:0> and int(top) > <NUM_LIT:0>:<EOL><INDENT>draw.text(x=int(left), y=int(top), body=clust)<EOL><DEDENT>draw.pop()<EOL><DEDENT><DEDENT>draw(img)<EOL>img.save(filename=html_path + filename_prefix + "<STR_LIT>" + str(i) + "<STR_LIT>")<EOL>imgs.append(img)<EOL><DEDENT>return imgs<EOL>
Displays each of the bounding boxes passed in 'boxes' on images of the pdf
pointed to by pdf_file
boxes is a list of 5-tuples (page, top, left, bottom, right)