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

Free Support Forum - aspose.com

Add image into a pdf file on centos 7

    public static bool Convert2(string image, string pdf)
            using Document doc = new Document
                OptimizeSize = true,
                IgnoreCorruptedObjects = true
            Page p = doc.Pages.Add();
            Rectangle rect = p.TrimBox;

            using Stream input = File.OpenRead(image);
            using MemoryStream stream = new MemoryStream();
            p.AddImage(input, rect);
            return true;
        catch (Exception)
            return false;

the codes can execute successfully.
but I got a WARNING on console,as following(when the image is pngformat):

** (process:17336): WARNING **: 08:56:48.434: Unknown metafile format: key 1196314761

or (when the image is jpeg format)

** (process:17336): WARNING **: 08:56:48.434: Unknown metafile format: key -520103681


We have tested the scenario using latest version of Aspose.PDF for .NET 22.2 with .NET 5.0 and have not found the shared issue. Could you please share your working environment along with Visual Studio project to reproduce the same issue at our end?