We're sorry GroupDocs doesn't work properply without JavaScript enabled.

Free Support Forum - groupdocs.com

PDF to PNG conversion in .NET on Linux

Hi. There is a problem with a conversion of specific PDF files to any image format on Linux which results in an unhandled(uncatchable) exception which crashes the whole process.

: ** (process:1): WARNING **: 21:23:27.964: Path conversion requested 62302240 bytes (1144 x 13615). Maximum size is 8388608 bytes.
: ERROR:region.c:1155:GdipCombineRegionPath: assertion failed: (region->bitmap)

The issue is probably a result of high quality PDF and limitations of libgdiplus. I could not find PdfLoadOptions/ImageConvertOptions setting to overcome this issue. It would be great to have some quality optimization options in PdfLoadOptions(before actual conversion).

File: frist_page.pdf (1.0 MB)

Ubuntu 20, .NET 5, GroupDocs.Conversion 21.8.0/21.5.0.


Could you please share the sample code? We’ll then look into this scenario.

Code is straight forward. Width = 150, Height = 180. Other PDFs are working fine.

        public byte[] ConvertToPng(byte[] source, int width, int height)
            var options = new ImageConvertOptions
                Format = ImageFileType.Png,
                Width = width,
                Height = height,
                PageNumber = 1,
                PagesCount = 1,
                Pages = new List<int> { 1 }

            return Convert(source, options);

        private byte[] Convert(byte[] source, ConvertOptions options)
            using var sourceStream = new MemoryStream(source);
            using var outputStream = new MemoryStream();

            using var converter = new Converter(() => sourceStream);

            converter.Convert(() => new MemoryStream(), resultStream => 
 resultStream.CopyTo(outputStream), options);

            _logger.LogInformation("PngConverter has finished png file generation");

            outputStream.Seek(0, SeekOrigin.Begin);
            return outputStream.ToArray();


This issue is under investigation with ticket ID CONVERSIONNET-4830. You’ll be notified in case of any update.