White and Black font invert on pdf conversion to PNG on docker (debian)

Hello,

When I launch this code on docker the font is invert, some part of the image became black and other one blank => see my sample image in attachement and the original pdfAsposeTicketQrCodeFactureSuisse.zip (9.2 MB)

On windows no problem

//load pdf from file

Aspose.Pdf.Document pdf = new(ms);

        BarCodeResult[] barCodeResults;

        MemoryStream imgStream;





        int pageCount = 0;

        foreach (var pdfPage in pdf.Pages)

        {                                

            imgStream = pdfPage.ConvertToPNGMemoryStream();

            pageCount++;

            using (FileStream outputFileStream = new FileStream($"{pageCount}.png", FileMode.Create))

            {

                imgStream.CopyTo(outputFileStream);            

            }

}

Thanks for you help
regards,
Nicolas

@NNO

Would you please make sure that libgdiplus and msttcorefonts packages are correctly installed in the environment where you are performing the conversion? Also, please make sure to use the latest version of the API. In case issue still persists, please share your docker file with us so that we can test the scenario in our environment and address it accordingly.

Hello,

My docker file Dockerfile.zip (875 Bytes)

Yes I have install the required package :slight_smile:
RUN apt-get update && apt-get install -y libgdiplus

RUN sed -i’.bak’ ‘s/$/ contrib/’ /etc/apt/sources.list

RUN apt-get update; apt-get install -y ttf-mscorefonts-installer fontconfig

Thanks

@NNO

We are checking it and will get back to you shortly.

@NNO

We tried to execute the code snippet share by you using the docker file and VS2022 but we faced some errors. They may be related to the configuration settings at our end. Could you please share a sample VS application for our reference so that we can further proceed to test the case accordingly?

Hello,

I send you the project to reproduce :
ConsoleAppTestAsoposePdfConvertToPng.zip (2.1 MB)

I use a docker compose file with this lines

docker-compose.zip (398 Bytes)

version: “3.8”

services:

net6sdkyoudocsources:

    image: mcr.microsoft.com/dotnet/sdk:6.0

    volumes:
  • C:\Users\nnoel\PROJETS\youdocacquisition\sourcesmaster:/DRIVE_WINDOWS #The path to > the project

     networks:
    
         - legacy
    
     command: tail -F anything
    

networks:

legacy:

Use command inside folder contains the docker file => docker-compose up -d

I attach to the docker with vscode docker extension
image.png (188.1 KB)

An now i can install the requiremenent packages gdip (etc…) on the docker :

apt-get update && apt-get install -y libgdiplus

sed -i’.bak’ ‘s/$/ contrib/’ /etc/apt/sources.list

apt-get update; apt-get install -y ttf-mscorefonts-installer fontconfig

Execute dotnet run command and see the result file :
image.png (348.3 KB)

Regards Nicolas

Be carefull to add this line in the csproj if you don’t use mine

image.png (119.6 KB)

@NNO

Thanks for providing more information. We are working on reproducing the issue and will get back to you shortlyl.

Any update ?

@NNO

We were able to replicate the issue in our environment and have logged it as PDFNET-52144 in our issue tracking system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hello,

Any update?

Thanks
Nicolas

@NNO

We are afraid that the earlier logged ticket could not get resolved yet. We will surely investigate and fix the issue on a first come first serve basis and let you know once we make some progress towards its resolution. Please spare us some time.

We are sorry for the inconvenience.