Hello,
I have been attempting to convert an Excel workbook to a PDF document using XlsIO. I am using the latest version of .NET MAUI on Android 12. Here is the error:
---> System.InvalidOperationException: The version of the native libSkiaSharp library (88.0) is incompatible with this version of SkiaSharp. Supported versions of the native libSkiaSharp library are in the range [80.2, 81.0).
at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Version minSupported, Version current, Boolean throwIfIncompatible)
at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Boolean throwIfIncompatible)
at SkiaSharp.SKObject..cctor()
--- End of inner exception stack trace ---
at SkiaSharp.SKPaint..ctor(IntPtr handle, Boolean owns)
at SkiaSharp.SKPaint..ctor()
at Syncfusion.Drawing.SkiaSharpHelper.FontExtension..ctor(String fontName, Single fontSize, FontStyle style, GraphicsUnit unit)
at Syncfusion.XlsIORenderer.ExcelToPdfConverter.GetPdfTrueTypeFont(Font font, Boolean isEmbedFont, Stream alternateFontStream)
at Syncfusion.XlsIORenderer.ExcelToPdfConverter.GetPdfFont(Font nativeFont, Boolean isEmbedFont, Stream alternateFontStream)
at Syncfusion.XlsIORenderer.ExcelToPdfConverter.DrawCells(WorksheetImpl sheet, Int32 firstRow, Int32 firstColumn, Int32 lastRow, Int32 lastColumn, PdfGraphics graphics, Single originalWidth, Single startX, Single startY, Single rangeWidth)
at Syncfusion.XlsIORenderer.ExcelToPdfConverter.DrawRow(IWorksheet wkSheet, Int32 startColIndex, Int32 endColIndex, Int32 startRowIndex, Int32 endRowIndex, Single xValue, Single yValue, Single originalWidth, Single startX, Single startY, Single rangeWidth, Single rangeHeight)
at Syncfusion.XlsIORenderer.ExcelToPdfConverter.DrawRow(IWorksheet wkSheet, Int32 startColumn, Int32 endColumn, Int32 startRow, Int32 endRow, Single xValue, Single yValue, Single originalWidth, Boolean isBlank)
at Syncfusion.XlsIORenderer.ExcelToPdfConverter.DrawSheet(IWorksheet wkSheet, IRange[] printAreas)
at Syncfusion.XlsIORenderer.ExcelToPdfConverter.DrawWorkSheet(IWorksheet worksheet, Int32 sheetsCount, LayoutOptions layoutOptions)
at Syncfusion.XlsIORenderer.ExcelToPdfConverter.ConvertDocument()
at Syncfusion.XlsIORenderer.ExcelToPdfConverter.Convert()
at Syncfusion.XlsIORenderer.XlsIORenderer.ConvertToPDF(IWorkbook workbook)
How can I go about fixing this?
A link to the repository for the app is https://github.com/mvan4310/NSSInvoiceApp
The problem is in the DataService class, inside the ConvertInvoiceToPDF function at line 280. The two lines are commented out at the moment until I could find a fix.
I have updated the Nuget references from Xamarin to .Net versions, and am now experiencing a different but related error:
System.TypeInitializationException
Message=The type initializer for 'SkiaSharp.SKObject' threw an exception.
I have pushed the changes for the nugets and uncommented lines for the XlsIORenderer. I apologize if I am overlooking something.
Edit to Add: I am able to create and modify Excel documents. It seems to be the conversion to PDF that is the only issue.
Final edit: This was solved. It took me removing the packages again, adding them back in, and cleaning the project before rebuilding. I appreciate all the help