Converting file with incorrect extension to PNG takes several minutes in .NET

Converting this incorrectly named PDF file to PNG, takes several minutes (over 20 on my machine).

I’m aware that it’s not probably not a good use-case that a PDF is incorrectly renamed to MSG, but we actually had this issue with one of our customers.

When converting the file to PNG it takes several minutes:

        using (var conv = new Converter(documentPath))
        {
            var imgOptions = new ImageConvertOptions()
            {
                Format = ImageFileType.Png,
                //convert only the first page for thumbnail
                PageNumber = 1,
                PagesCount = 1
            };

            string filePath = "Conversion{0}.png";
            Func<int, Stream> getPageStream = page => new FileStream(string.Format(filePath, page), FileMode.Create);
            conv.Convert(getPageStream, imgOptions);
        }

Could you please analyze why it takes that long?
Do you think it would be possible, to detect such incorrect file somehow and throw some error faster?

Best regards,
Clemens

1 Like

@Clemens_Pestuka
Yes, the conversion is taking time. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CONVERSIONNET-6268

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
In the investigation, we’ll assess if it’s even possible to throw an exception in such a case.

1 Like