def display_with_bboxes(
        self,
        nodes: List[Node],
        page_nums: Optional[List[int]] = None,
        annotations: Optional[List[str]] = None,
    ):
        """
        Display a single page of a PDF file using IPython.
        Optionally, display a piece of text on top of the bounding box.
        """
        try:
            from IPython.display import Image, display  # type: ignore
        except ImportError as err:
            raise ImportError(
                "IPython is required to display PDFs. Please install it with `pip install ipython`."
            ) from err
        assert nodes, "At least one node is required."

        bboxes = [node.bbox for node in nodes]
        flattened_bboxes = _prepare_bboxes_for_drawing(bboxes, annotations)
        marked_up_doc = self._draw_bboxes(flattened_bboxes, nodes[0].coordinate_system)
        if not page_nums:
            page_nums = list(range(marked_up_doc.page_count))
        for page_num in page_nums:
            page = marked_up_doc[page_num]
            img_data = page.get_pixmap().tobytes("png")
            display(Image(data=img_data))

        Display a single page of a PDF file using IPython.
        Optionally, display a piece of text on top of the bounding box.
        
src/openparse/pdf.py