def _page_document(
        self, elements: List, output_type: OutputType, split: SplitType
    ) -> List[Document]:
        """
        Combines elements with the same page number into a single Document object.

        Args:
            elements (List): A list of elements containing page numbers.
            output_type (OutputType): The output type of the document.
            split (SplitType): The split type of the document.

        Returns:
            List[Document]: A list of Document objects, each representing a page
                            with its content and metadata.

        """
        _docs = []
        pages = sorted({x["page"] for x in elements})

        page_group = [
            [element for element in elements if element["page"] == x] for x in pages
        ]

        for group in page_group:
            page_content = " ".join(
                [parse_output(element, output_type) for element in group]
            )

            _docs.append(
                Document(
                    text=page_content.strip(),
                    extra_info={
                        "page": group[0]["page"],
                        "type": output_type,
                        "split": split,
                    },
                )
            )

        return _docs

        Combines elements with the same page number into a single Document object.

        Args:
            elements (List): A list of elements containing page numbers.
            output_type (OutputType): The output type of the document.
            split (SplitType): The split type of the document.

        Returns:
            List[Document]: A list of Document objects, each representing a page
                            with its content and metadata.

        
llama-index-integrations/readers/llama-index-readers-upstage/llama_index/readers/upstage/base.py