async def convert(
        self, local_path: str, **kwargs: Any
    ) -> Union[None, AsyncDocumentConverterResult]:
        """Convert a PDF file to markdown.

        Args:
            local_path: Path to the PDF file
            **kwargs: Additional arguments passed to converters

        Returns:
            AsyncDocumentConverterResult containing the markdown text
        """
        extension = kwargs.get("file_extension", "")
        if extension.lower() != ".pdf":
            return None

        md_content = ""
        title = None

        try:
            # Try using PyPDF2 first
            import PyPDF2

            with open(local_path, "rb") as file:
                reader = PyPDF2.PdfReader(file)

                # Try to extract title from metadata
                if reader.metadata and hasattr(reader.metadata, "title"):
                    title = reader.metadata.title

                # Extract text from each page
                for i, page in enumerate(reader.pages):
                    page_text = page.extract_text()
                    if page_text:
                        md_content += f"\n\n## Page {i + 1}\n\n{page_text}\n"
        except ImportError:
            # Fall back to pdfminer.six if PyPDF2 is not available
            try:
                from pdfminer.high_level import extract_text

                text = extract_text(local_path)
                md_content = text
            except ImportError:
                # If neither library is available, use subprocess to call external tools
                try:
                    # Try pdftotext if available
                    if shutil.which("pdftotext"):
                        result = subprocess.run(
                            ["pdftotext", local_path, "-"], capture_output=True, text=True
                        )
                        md_content = result.stdout
                    else:
                        return AsyncDocumentConverterResult(
                            title=None,
                            text_content=(
                                "PDF conversion requires PyPDF2, pdfminer.six, or pdftotext."
                            ),
                        )
                except Exception as e:
                    logger.error(f"Error converting PDF with external tools: {str(e)}")
                    return None

        return AsyncDocumentConverterResult(title=title, text_content=md_content.strip())
Convert a PDF file to markdown.

        Args:
            local_path: Path to the PDF file
            **kwargs: Additional arguments passed to converters

        Returns:
            AsyncDocumentConverterResult containing the markdown text
        
backend/airweave/platform/file_handling/async_markitdown.py