New version Aspose.Pdf

Esteemed team, we are a .NET development company from Italy, we have purchased a new license for Aspose Total family lasted version (17.9).
Now in production environment, we have a software for to convert images to PDF and we are using the ASPOSE components of the previous version.
How can we update our code without anomalies?

Aspose.Pdf.Generator class is obsolete, what is there now?
In particolar, what is the equivalent of : Aspose.Pdf.Generator.ImageFileType.Unknown??

Best regards

This is the code :

    public static byte[] ConvertiImmagineConAspose(byte[] buffer, string Extesion = "")
    {
        MemoryStream msIN = new MemoryStream(buffer);
        try
        {

            Aspose.Imaging.License Licenza = new Aspose.Imaging.License();
            //Licenza.SetLicense("Aspose.Total.lic");
            Licenza.SetLicense("xxxxxxxxx");
          
            // Create a PDF object
            Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();

            // Create a section and add it to pdf document
            Aspose.Pdf.Generator.Section MainSection = pdf.Sections.Add();
            // Create an image object
            Aspose.Pdf.Generator.Image sample_image = new Aspose.Pdf.Generator.Image(MainSection);



            // Specify the image file path information
            //sample_image.ImageInfo.MemoryData = buffer;
            // Specify the image file type

            switch (Extesion)
            {
                case "bmp":
                    sample_image.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Bmp;
                    break;
                case "png":
                    sample_image.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Png;
                    break;
                case "gif":
                    sample_image.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Gif;
                    break;
                case "jpg":
                    sample_image.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Jpeg;
                    break;
                case "jpeg":
                    sample_image.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Jpeg;
                    break;
                case "tiff":
                    sample_image.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Tiff;
                    break;
                case "tifF":
                    sample_image.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Tiff;
                    break;
                case "eps":
                    sample_image.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Unknown;
                    break;
                default:
                    sample_image.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Unknown;
                    break;

            }

            sample_image.ImageInfo.ImageStream = msIN;


            //sample_image.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Unknown;

            // Specify the image width information equal to page width 
            sample_image.ImageInfo.FixWidth = MainSection.PageInfo.PageWidth - MainSection.PageInfo.Margin.Left - MainSection.PageInfo.Margin.Right;
            // Specify the image Height information equal to page Height
            sample_image.ImageInfo.FixWidth = MainSection.PageInfo.PageHeight - MainSection.PageInfo.Margin.Top - MainSection.PageInfo.Margin.Bottom;

            // Create bitmap image object to load image information
            Bitmap myimage = new Bitmap(msIN);

            // Check if the width of the image file is greater than Page width or not
            if (myimage.Width > MainSection.PageInfo.PageWidth)
            {
                // If the Image width is greater than page width, then set the page orientation to Landscape
                MainSection.IsLandscape = true;
            }
            else
            {
                // If the Image width is less than page width, then set the page orientation to Portrait
                MainSection.IsLandscape = false;
            }

            // Add image to paragraphs collection of section
            MainSection.Paragraphs.Add(sample_image);

            MemoryStream msOUT = new MemoryStream();
            // Save the resultant PDF
            pdf.Save(msOUT);
          
            return msOUT.ToArray();
        }
        catch (Exception ex)
        {
            throw;
        }

    }

@enricoe,

Thanks for contacting support.

Please try using Aspose.Pdf.Image object of new Document Object Model for the conversion of Image files to PDF format. Please note that in this new approach, you do not need to specify the image file type because the API will automatically determine its type. For further details, please visit How to convert Image file to PDF format.

In case you encounter any issue, please share the input image files.