We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

System.PlatformNotSupportedException: Operation is not supported on this platform


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/
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


Aspose.Cells for .NET also includes Xamarin supported Dlls that you may try. The following folders are there in the release archive (when you install via its MSI Installer or extract the Dlls version) containing receptive Xamarin libraries:
Xamarin.iOS - it contains assemblies to use Aspose.Cells with Xamarin.iOS.
Xamarin.Android - it contains assemblies to use Aspose.Cells with Xamarin.Android.

Hope, this helps a bit.

The issue is coming for Cocoa Application for MacOS

Could you please share a test application which can be compiled and executed here to reproduce the issue? Also share the IDE details with us for our analysis.

DocsToPDFConverter.zip (1.2 MB)

Here is the test project.
IDE details: Visual Studio for Mac v8.8.7

We have observed the issue and logged it in our database for further investigation. You will be notified here once any update is ready for sharing.

This issue is logged as:
CELLSNETCORE-106 - System.PlatformNotSupportedException: Operation is not supported on this platform during Excel to PDF conversion

Hi @10aditya
Currently, we provide the Aspose.Cells for Xamarin library, but do not include the drawing functions.

If you call aspose.Cells for NetStandard from your Xamarin project, as the System.Drawing.Common library does not support Xamarin, aspose.Cells for NetStandard will not support drawing on Xamarin too.

The only solution currently available is to create a .NetStandard project with VS for Mac, and then call the Aspose.Cells for NetStandard library, which supports drawing. But it’s not a Xamarin project.