Problem in updating groupdocs.conversion from 19.6 to 20.8

I have a set of code like below

#region Conversion
public static GroupDocs.Conversion.Handler.ConversionHandler GetConversionHandler(bool isUseCache)
{
    GroupDocs.Conversion.Config.ConversionConfig conversionConfig = new GroupDocs.Conversion.Config.ConversionConfig { StoragePath = StoragePath, CachePath = CachePath, OutputPath = OutputPath };
    // Set to use cache or not
    conversionConfig.UseCache = isUseCache;
    // Creating new ConversionHandler class object with ConversionConfig object
    GroupDocs.Conversion.Handler.ConversionHandler conversionHandler = new GroupDocs.Conversion.Handler.ConversionHandler(conversionConfig);
    // Returns the ConversionHandler static object
    return conversionHandler;
}
public static byte[] ConvertToPdfFromStreamToStream(byte[] inputFileBytes)
{
    GroupDocs.Conversion.Handler.ConversionHandler conversionHandler = GetConversionHandler(false);
    using (MemoryStream inputStream = new MemoryStream(inputFileBytes))
    {
        var convertedDocumentStream = conversionHandler.Convert(inputStream, new GroupDocs.Conversion.Options.Save.PdfSaveOptions());
        using (MemoryStream targetStream = new MemoryStream())
        {
            convertedDocumentStream.Save(targetStream);
            return targetStream.ToArray();
        }
    }
}
public static byte[] ConvertToImageFromStreamToStream(byte[] inputFileBytes, GroupDocs.Conversion.Options.Save.ImageSaveOptions.ImageFileType outputFileType = GroupDocs.Conversion.Options.Save.ImageSaveOptions.ImageFileType.Tif, List<int> convertPages = null)
{
    GroupDocs.Conversion.Handler.ConversionHandler conversionHandler = GetConversionHandler(false);

    var saveOptions = new GroupDocs.Conversion.Options.Save.ImageSaveOptions
    {
        ConvertFileType = outputFileType,
        TiffOptions = { Compression = GroupDocs.Conversion.Options.Save.TiffOptions.TiffCompression.Lzw },
        HorizontalResolution = 200,
        VerticalResolution = 200,
        PageNumber = 1,
        NumPagesToConvert = 1
    };
    using (MemoryStream inputStream = new MemoryStream(inputFileBytes))
    {
        var convertedDocumentStream = conversionHandler.Convert(inputStream, saveOptions);
        using (MemoryStream targetStream = new MemoryStream())
        {
            convertedDocumentStream.Save(targetStream);
            return targetStream.ToArray();
        }
    }
}
#endregion

the above code runs on groupdocs.conversion 19.6.0 but now I updated groupdocs.conversion to 20.8 the above code is not working and throwing error,

how can I convert the above set of code to be able to run on version 20.8?

1 Like

@Niteen_Jadhav

We’d recommend you to take a look at the migration notes and this sample application.