PDF to PNG conversion issue on CentOS 7

Hi @Atir_Tahir, I have the same issue, below is the error log that I got from the openShift pod’s logger.

** (process:1): WARNING **: 01:41:03.983: Path conversion requested 8442880 bytes (1280 x 1649). Maximum size is 8388608 bytes.
**
ERROR:region.c:1155:GdipCombineRegionPath: assertion failed: (region->bitmap)

Have you found a solution to this issue?
For additional information, we are using CentOS 7 and the file size is only 1.4Mb.

1 Like

@teguhmargaretha2010

Make sure this issue is not because of libgdiplus limitations. Did you install libgdiplus in your environment? If issue persists, could you please share a sample application and the problematic file using that issue could be reproduced at our end?

Hi @Atir_Tahir,
I push a sample application here document-viewer. Could you access and check it for me?
Also, I am using GroupDocs Total Family license on my original project, but I don’t store the license on the sample application, I hope you can use the license when checking the issue and get the same issue as me.
And I attached the problematic file too.
Thank you.
PKB.pdf (1.3 MB)

Yes, I think this is because of libgdiplus limitations. We did install the libgdiplus library in our environment.

@teguhmargaretha2010

The issue has been partially reproduced - I can see a lot of warnings.png (154.0 KB) printed in the console but I can’t reproduce the error ERROR:region.c:1155:GdipCombineRegionPath: assertion failed: (region->bitmap). The app is running well and shows the output app-running.png (131.2 KB)

I’ve installed libgdiplus by typing the following

  • Add mono repository
    rpmkeys --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
    su -c 'curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo'
  • Install libgdiplus
    yum install libgdiplus

Can you please try installing\reinstalling libgdiplus and run the app again?

Hi @vladimir.litvinchik

Here is a part of my docker file script :

# Build runtime image

FROM {ARTIFACTORY_URL}/dotnet/core/aspnet:3.1
RUN apt-get update && apt-get install -y libfontconfig1
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

Should I replace the RUN apt-get update && apt-get install -y libgdiplus command with yum install libgdiplus command?

@teguhmargaretha

No, you should not replace apt-get with yum. Since your base image is /dotnet/core/aspnet:3.1 then you have to use APT package manager and apt-get utility to install the packages.

Hi @vladimir.litvinchik

I have tried to reinstall the libgdiplus and run the app, but I still get the same issue. It won’t happen if the converted file is only 2 pages, but it happened when the converted file is 41 pages.

@teguhmargaretha2010

Thank you for sharing the details. We’ll take a look and update you.

@teguhmargaretha2010

Unfortunately, I have failed to reproduce this issue when running the attached sample application in CentOS 7 see rendered-page-41.png (287.7 KB). Do you run this app in Docker container?

Hi @vladimir.litvinchik

Yes, we run the app in a Docker container. We are using Openshift and JFrog as our tools and also Gitlab for the repository. I hope this information is useful for you.

@teguhmargaretha2010

Thank you for sharing the details. Please do share the sample application and Dockerfile that we can use to reproduce the issue at our end.

Hi @vladimir.litvinchik

I have uploaded the sample application here document-viewer. And here is the Docker file Dockerfilewithgroupdocs.docx (10.8 KB).
Thank you

@teguhmargaretha2010

Thank you for attaching your Dockerfile as it helped to find the root cause of this issue.

Solution

Replace in your Docker file the following line

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

with

RUN apt-get update && apt-get install -y gnupg
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \
    && echo "deb https://download.mono-project.com/repo/ubuntu stable-buster main" >> /etc/apt/sources.list.d/mono-official-stable.list \
    && apt-get update \
    && apt-get install -y libgdiplus

that will install the latest stable version of libgdiplus package.

The complete Dockerfile can be downloaded at Dockerfile.zip (840 Bytes)

Root cause

GroupDocs.Viewer heavily relies on System.Drawing.Common assembly that is using libgdiplus under the hood. See more details at Install .NET on Debian - .NET | Microsoft Learn, quote:

For .NET Core apps that use the System.Drawing.Common assembly, you also need the following dependency:

  • ibgdiplus (version 6.0.1 or later)

Unfortunately, the default apt repository contains an outdated version of libgdiplus package. In this case it is 4.2-2. This can be checked by running apt-get -s install libgdiplus in a Docker container and the output would be similar to

Reading package lists... Done
Building dependency tree       
Reading state information... Done
libgdiplus is already the newest version (4.2-2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

When the required version is 6.0.1 or later. To install the latest version we need to add the repository with the latest build

RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \
    && echo "deb https://download.mono-project.com/repo/ubuntu stable-buster main" >> /etc/apt/sources.list.d/mono-official-stable.list

and after that install the latest version.

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

Please let us know if it works for you.

1 Like

Hi @vladimir.litvinchik

Thank you for your complete explanation !
I have followed your instruction above and I am so happy that my viewer application is working well now.

1 Like

Thanks @vladimir.litvinchik, this helped us as well. Could this be added to the GroupDocs documentation? .NET Standard 2.0 API Limitations | Documentation

1 Like

@teguhmargaretha2010

You’re welcome!

@IhorC

You’re welcome.

The documentation article .NET Standard 2.0 API Limitations | Documentation has been updated.

1 Like