download_blob()将blob下载到一个
StorageStreamDownloader
类中,并且在该类中有个
download_to_stream,您将获得blob流。
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClientfrom io import BytesIOimport PyPDF2filename = "test.pdf"container_name="test"blob_service_client = BlobServiceClient.from_connection_string("connection string")container_client=blob_service_client.get_container_client(container_name)blob_client = container_client.get_blob_client(filename)streamdownloader=blob_client.download_blob()stream = BytesIO()streamdownloader.download_to_stream(stream)fileReader = PyPDF2.PdfFileReader(stream)print(fileReader.numPages)
这就是我的结果。它将打印pdf页码。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)