Free Support Forum - aspose.com

PDF to Image (DotNetCore 2.1) - ERROR:region.c:1155:GdipCombineRegionPath: assertion failed: (region->bitmap)

Hi all,

I get the following error when trying to convert a PDF page to an image.
ERROR:region.c:1155:GdipCombineRegionPath: assertion failed: (region->bitmap)

Please see the _usr_share_dotnet_dotnet.1000.crash.zip (7.6 MB)
crash file attached.

Project Setup:
Aspose.Pdf Version: 18.6.0
Framework: .NET Core 2.1
Type: Console Application

Source PDF file
Size: 181 KB
Page count: 4

Sample code:

    public ImageData GenerateImage(byte[] pdfData, int pageNo)
    {
        var imageStream = new MemoryStream();
        var pdfMemoryStream = new MemoryStream(pdfData);
        var pdfDocument = new Document(pdfMemoryStream);
        Resolution resolution = new Resolution(300);
        var pageToPrint = pdfDocument.Pages[pageNo];
        PngDevice pngDevice = new PngDevice(resolution);

        //This line causes the error
        pngDevice.Process(pageToPrint, imageStream );
    }        

Notes:
This works fine on a Windows machine but produces the error on a Linx 64bit Docker container.

Any help would be appreciated.

Regards,
Jacques

@jacquesb,

Kindly send us your problematic source PDF file, and let us know the page number parameter. Please also share details of the Linux environment, e.g. Operating System (name & version) etc. Your response is awaited.

Hi @imran.rafique,

I have shared a sample project for your convenience. (https://drive.google.com/open?id=1v54df6JkmxKNqtuIOHOMXG2KEFhGchC-)
The source file is single page PDF with one sentence. (Filename: mypdf.pdf)

The project also contains a docker file that can be executed from the top level. (The same level as the .sln file)

The command used to build the docker file: docker build . -t alphaimage -f ./DocumentManager_Aspose/Dockerfile

Looking forward to your response.

@jacquesb,

An investigation has been logged under the ticket ID PDFNET-44940 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.

Hi @imran.rafique,

Thank you for the feedback. Do you have any timelines for when this ticket will be addressed? (I need to make a few technical decisions for a new project and any sort of timeline from your side will really help with this)

Thank you for all your help so far.

@jacquesb,

We have just logged an investigation and it is difficult to share an estimate. Please install libgdiplus and ttf-mscorefonts-installer packages and also try with .NET Core 2.0, and then let us know how that goes into your environment. Please refer to this help topic: Working with .NET Core DLLs in Non-Windows Environment

@imran.rafique

I have just tested it with the suggested packages and the same error still occurs.
I do understand that timelines are difficult, but are we talking about days, weeks or months before I will get feedback on this issue?

Is there anything else that I can do to assist with the investigation?
Have you created the docker container to see the actual error message?

Also, see the attached output from linux when debugging is turned on. aspose_test_debug_output.zip (3.1 KB)

@jacquesb,

In order to escalate priority, we recommend our clients to post their critical issues (ticket Ids) in the paid support forum. Please refer to this helping link: Aspose support options. We are investigating your scenario, and will keep you informed regarding any available updates.

This information has been logged under the same ticket ID PDFNET-44940.

@imran.rafique
Noted, thank you.

Hello Imran

Is there anyway that we can expedite this - if we can get this to work then we will change our subscription from the Java version tot he .net core version.

Please also let me know how we can add maintenance onto our subscription so that we can get fast support on this.

@rjohansen,

As narrated in our previous post, you can escalate priority by posting the critical issues or ticket IDs in the paid support forum. Please refer to this helping link: Aspose support options. In order to gather details regarding the enhancement of subscription with Aspose, Please post in the Aspose.Purchase forum. We have created a separate thread in Aspose.Purchase forum, and will assist you there soon.
https://forum.aspose.com/t/add-maintenance-onto-our-subscription/178783

Hi @imran.rafique and @rjohansen,

Just some feedback. We managed to get the application to generate the image by changing the resolution to 147 instead of 300. (Any resolution higher than 147 will cause the application to crash with the above-mentioned exception.)

Unfortunately, 147 is not a magic number and have to be changed depending on the size of the PDF file. For instance, when I tried it with a 10 MB PDF file I had to lower the resolution. (I just tried 100 and it worked)

It is also worth mentioning, the image that got generated on Linux is different from the image generated on Windows using the same code base. (The Linux version omitted certain elements(images))

I trust that the Aspose team will look into this soon and provide a reliable workaround/fix.

@jacquesb,

We have recorded your feedback under the linked ticket ID PDFNET-44940, and let you know once a significant progress has been made in this regard.

Hi. I would like to know if this bug has been fixed?

@kityeo

Thank you for getting back to us.

We are afraid PDFNET-44940 is still unresolved owing to previously logged and critical tickets. We have recorded your concerns and will let you know once any update will be available.