Hi,
I am trying to save Excel files in MemoryStream in PDF format. But program throws the following exception:
System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Drawing.Imaging.ImageFormat.get_Emf () [0x00000] in <854806eb611c4147b9589426ff55b563>:0
at Aspose.Cells.PdfSaveOptions…ctor (Aspose.Cells.SaveOptions ) [0x00000] in <903b03d988d847410675f587db3c85e6>:0
at Aspose.Cells.FileFormatUtil. (System.String , Aspose.Cells.FileFormatType , Aspose.Cells.SaveFormat , Aspose.Cells.SaveOptions ) [0x0012d] in <903b03d988d847410675f587db3c85e6>:0
at Aspose.Cells.Workbook.Save (System.IO.Stream stream, Aspose.Cells.SaveFormat saveFormat) [0x00007] in <903b03d988d847410675f587db3c85e6>:0
at SampleLibary.Class1.getPDFDataStream (System.IO.Stream fileDataStream, System.String filePath) [0x00057] in /Users/adityapingle/Projects/SampleTest/SampleLibary/Class1.cs:23
at SampleMain.ViewController.ConvertToPDFAndDisplayDocument (Foundation.NSUrl url) [0x000cf] in /Users/adityapingle/Projects/SampleTest/SampleMain/ViewController.cs:68
at SampleMain.ViewController.ViewDidLoad () [0x00054] in /Users/adityapingle/Projects/SampleTest/SampleMain/ViewController.cs:26
at at (wrapper managed-to-native) AppKit.NSApplication.NSApplicationMain(int,string[])
at AppKit.NSApplication.Main (System.String[] args) [0x00040] in /Library/Frameworks/Xamarin.Mac.framework/Versions/7.2.0.3/src/Xamarin.Mac/AppKit/NSApplication.cs:109
at SampleMain.MainClass.Main (System.String[] args) [0x00007] in /Users/adityapingle/Projects/SampleTest/SampleMain/Main.cs:10
My code:
if (isExcelFile(filePath))
{
Console.WriteLine("Excel File");
System.IO.MemoryStream pdfDataStream = new System.IO.MemoryStream();
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(fileDataStream);
workbook.Save(pdfDataStream, Aspose.Cells.SaveFormat.Pdf);
return pdfDataStream;
}
It works if the application is .NET Console Application but I am trying to use the API in Xamarin.Mac Cocoa Application.
Aspose.Cells version: 21.2.0
System.Drawing.Common version: 5.0.0
Xamarin.Mac version: Modern
OSX version: 10.15.7
MacOS SDK version: 11.0