- Code: Select all
private byte[] ConvertWithSpire()
{
// Original Windows Spire-based implementation
using (var excelStream = new MemoryStream(_package))
{
var workbook = new Workbook();
workbook.LoadFromStream(excelStream);
var sheet = workbook.Worksheets[0];
sheet.PageSetup.FitToPagesWide = 1;
sheet.PageSetup.FitToPagesTall = 0;
using (var pdfStream = new MemoryStream())
{
workbook.SaveToStream(pdfStream, FileFormat.PDF);
return pdfStream.ToArray();
}
}
}
This works locally on my Windows dev environment, but when I publish to my `Linux` container in production. Which is running `Debian 12 Bullseye`, I get the following exception;
[08:03:27 ERR] [ExcelService] The type initializer for 'Spire.Xls.Core.Spreadsheet.XlsPageSetupBase' threw an exception.
digging down deeper the inner exception is;
---> System.InvalidOperationException: The version of the native libSkiaSharp library (119.0) is incompatible with this version of SkiaSharp. Supported versions of the native libSkiaSharp library are in the range [88.1, 89.0).
To clarify I have;
1. ensure the msfonts are installed on the docker container.
2. followed the various forum posts I have found to enable this to work on linux.
The following packages are installed to the class library;
- Code: Select all
FreeSpire.XLS @ 14.2.0
SkiaSharp @ 2.88.0
SkiaSharp.NativeAssets.Linux.NoDependencies @ 3.116.1
Spire.Officefor.NETStandard @ 10.2.0
System.Buffers @ 4.6.1
System.Memory @ 4.6.3
System.Runtime.CompilerServices.Unsafe @ 6.1.2
System.Text.Encoding.CodePages @ 9.0.4
Can anyone direct me how I can fix this issue?