Aspose split docx file wrongly in Docker, but works fine in local env

I am using Aspose to split a DOCX file into separate DOCX files for each page, and I am creating a Python Azure Function to perform this task. The splitting works correctly in both an Ubuntu Docker image and my local environment. However, when running in the Azure Functions Docker image, the last sentence of each page is incorrectly moving to the next page.

Before split :

After Split :
page 11 :

Here the “Please complete the following table which splits out the main sources of alpha for this strategy:” sentence is missing from the page 11 and it is appearing in the 12th Page.

Docker image I used for Azure-function

FROM mcr.microsoft.com/azure-functions/python:4-python3.11
# Set noninteractive frontend to suppress apt warnings
ENV DEBIAN_FRONTEND=noninteractive

# Enable contrib repository and install ttf-mscorefonts-installer
RUN apt-get update && \
    apt-get install -y --no-install-recommends software-properties-common && \
    add-apt-repository contrib && \
    apt-get update && \
    echo "msttcorefonts msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections && \
    apt-get install -y --no-install-recommends ttf-mscorefonts-installer && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y \
    ttf-mscorefonts-installer \
    libfontconfig1 \
    libgdiplus
RUN apt update && apt upgrade -y
RUN apt install -y wget
RUN wget http://archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu66_66.1-2ubuntu2_amd64.deb
RUN dpkg -i ./libicu66_66.1-2ubuntu2_amd64.deb
RUN wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb
RUN dpkg -i ./libssl1.1_1.1.0g-2ubuntu4_amd64.deb
RUN wget http://ftp.us.debian.org/debian/pool/main/libm/libmspack/libmspack0_0.11-1_amd64.deb
RUN dpkg -i ./libmspack0_0.11-1_amd64.deb
RUN wget http://ftp.us.debian.org/debian/pool/main/c/cabextract/cabextract_1.9-3_amd64.deb
RUN dpkg -i ./cabextract_1.9-3_amd64.deb
RUN wget http://ftp.us.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.8.1_all.deb
RUN dpkg -i ./ttf-mscorefonts-installer_3.8.1_all.deb
RUN apt --fix-broken install -y
 
RUN rm -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb
RUN wget -q https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb
RUN dpkg -i packages-microsoft-prod.deb
RUN apt update
RUN apt install azure-functions-core-tools-4
RUN rm -i packages-microsoft-prod.deb
 
RUN apt-get update && apt-get install -y curl apt-transport-https lsb-release gnupg
 
# Install Azure CLI
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash

######
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
    AzureFunctionsJobHost__Logging__Console__IsEnabled=true
 
COPY requirements.txt /
RUN pip install -r /requirements.txt
 
COPY . /home/site/wwwroot
WORKDIR /home/site/wwwroot

In the above docker file I am getting the issue… But when I am using the ubuntu image I am not getting the issue…

Docker file with ubuntu image:

FROM ubuntu:22.04
RUN apt update && apt install -y python3.11
RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections
RUN apt install -y ttf-mscorefonts-installer
RUN apt install -y python3-pip
RUN apt install -y wget
RUN python3.11 -m pip install pillow
RUN python3.11 -m pip install --upgrade pip
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2
RUN update-alternatives --auto python3
RUN wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb
RUN dpkg -i ./libssl1.1_1.1.0g-2ubuntu4_amd64.deb
RUN rm -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb
RUN wget -q https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb
RUN dpkg -i packages-microsoft-prod.deb
RUN apt update
RUN apt install azure-functions-core-tools-4
RUN rm -i packages-microsoft-prod.deb

RUN apt-get update && apt-get install -y curl apt-transport-https lsb-release gnupg

# Install Azure CLI
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash

######
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
    AzureFunctionsJobHost__Logging__Console__IsEnabled=true

COPY requirements.txt /
RUN pip install -r /requirements.txt

COPY . /home/site/wwwroot
WORKDIR /home/site/wwwroot

@sachithaPDF Most likely the problem on your side occurs because fonts required for building document layout are not available in your environment. To build an accurate document layout the fonts are required. If Aspose.Words cannot find the fonts used in the document the fonts are substituted . This might lead into the document layout difference due to difference in font metrics.
Please see our documentation to learn where Aspose.Words looks for fonts:
https://docs.aspose.com/words/python-net/specifying-truetype-fonts-location/