If I set any ICache
implementations other than NullCache, I get an exception during the conversion process. I’ve tried other internal cache implementations (MemoryCache and FileCache) and get the same exception.
I’ve also tried to run the example from the Github repo (“UseCacheWhenProcessingDocuments”) and it has the same behavior. How to use custom cache implementation | Documentation
This is using groupdocs-conversion version 22.3 (latest).
Exception
om.groupdocs.conversion.exceptions.GroupDocsConversionException: Type Name = AutoResetEvent, FullName = com.groupdocs.conversion.internal.c.a.ms.System.Threading.AutoResetEvent is not marked as Serializable.
Code
// HTML to PDF conversion (same behavior for image to PDF)
// CustomCache extends MemoryCache with delegates only.
final LoadOptions loadOptions = getLoadOptions(file);
final ConvertOptions<?> convertOptions = getConvertOptions(extension);
final ConverterSettings settings = new ConverterSettings();
settings.setCache(new CustomCache());
final ByteArrayOutputStream output = new ByteArrayOutputStream();
final Converter converter = new Converter(file.getInputStream(), loadOptions, settings);
converter.convert(output, convertOptions);
return output.toByteArray();