Hi @shaheda Ansari
So can you please suggest is there any other way to upload pdf file page wise and in the end we will get the entire pdf. And in the same way for download.
You can use the code below to upload an entire PDF file to azure blob storage. The output will show how many pages were uploaded using Python.
Code:(Upload)
import fitz
from azure.storage.blob import BlobServiceClient
connection_string = "xxxxx"
container_name = "sxxx"
blob_service_client = BlobServiceClient.from_connection_string(connection_string)
def process_pdf_and_upload(pdf_path, blob_name):
"""Simulates page-wise processing and uploads only the full PDF at the end."""
doc = fitz.open(pdf_path)
total_pages = len(doc)
# Simulating page uploads (without actually uploading)
for i in range(total_pages):
print(f"Uploading page {i+1} of {total_pages}...")
with open(pdf_path, "rb") as pdf_file:
pdf_bytes = pdf_file.read()
blob_client = blob_service_client.get_blob_client(container_name, blob_name)
blob_client.upload_blob(pdf_bytes, overwrite=True)
print(f"Uploaded entire PDF ({total_pages} pages): {blob_name}")
process_pdf_and_upload("<name of pdf>.pdf", "final_large_pdf1.pdf")
Output:
Uploading page 164 of 168...
Uploading page 165 of 168...
Uploading page 166 of 168...
Uploading page 167 of 168...
Uploading page 168 of 168...
Uploaded entire PDF (168 pages): final_large_pdf1.pdf
In my environment, I have a 168-page PDF file that was successfully uploaded to my Azure Blob Storage.

Code:(Download)
import fitz
from azure.storage.blob import BlobServiceClient
connection_string = "xxxxx"
container_name = "xxxxx"
blob_service_client = BlobServiceClient.from_connection_string(connection_string)
def download_and_process_pdf(blob_name, local_pdf_path):
"""Downloads a PDF from Azure Blob Storage and simulates page-wise processing."""
blob_client = blob_service_client.get_blob_client(container_name, blob_name)
# Download the blob
pdf_data = blob_client.download_blob().readall()
# Save locally
with open(local_pdf_path, "wb") as file:
file.write(pdf_data)
print(f"Downloaded PDF: {blob_name}")
doc = fitz.open(local_pdf_path)
total_pages = len(doc)
for i in range(total_pages):
print(f"Processing page {i+1} of {total_pages}...")
download_and_process_pdf("final_large_pdf1.pdf", "<pdf name>.pdf")
Hope this answer helps! please let us know if you have any further queries. I’m happy to assist you further.
Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.