async def _convert_pdf_to_images(self, input_file: Path) -> list[Image]:
        """Convert a PDF file to images.

        Args:
            input_file: The path to the PDF file.

        Raises:
            ParsingError: If the PDF file could not be converted to images.

        Returns:
            A list of Pillow Images.
        """
        document: pypdfium2.PdfDocument | None = None
        try:
            document = await run_sync(pypdfium2.PdfDocument, str(input_file))
            return [page.render(scale=4.25).to_pil() for page in cast("pypdfium2.PdfDocument", document)]
        except pypdfium2.PdfiumError as e:
            raise ParsingError(
                "Could not convert PDF to images", context={"file_path": str(input_file), "error": str(e)}
            ) from e
        finally:
            if document:
                await run_sync(document.close)
Convert a PDF file to images.

        Args:
            input_file: The path to the PDF file.

        Raises:
            ParsingError: If the PDF file could not be converted to images.

        Returns:
            A list of Pillow Images.
        
kreuzberg/_extractors/_pdf.py