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

Free Support Forum - aspose.com

System.IO.FileNotFoundException with Aspose.PDF in Mac OS

I am using Aspose.PDF in Mac OS with C# in visual studio 2019 for mac. Compilation is successful but when i run the program i get below exception.
System.IO.FileNotFoundException has been thrown.
Could not load the file System.Diagnostics.PerformanceCounter.

My code-
FileStream fs = new FileStream(strFileName, FileMode.Open);
Aspose.Pdf.HtmlLoadOptions htmlLoadOptions = new Aspose.Pdf.HtmlLoadOptions(strFileName);
htmlLoadOptions.PageInfo.IsLandscape = false;
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(fs,htmlLoadOptions);
pdfDocument.Save(strPDFFileName);

@sangapankaj

Thank you for contacting support.

We are afraid that the error may not be thrown by Aspose.PDF for .NET API. Please check if required file access permissions are allowed and file path is correct, and then share your kind feedback with us.

When i comment below four lines of code, i don’t get System.IO.FileNotFoundException error.

/*Aspose.Pdf.HtmlLoadOptions htmlLoadOptions = new Aspose.Pdf.HtmlLoadOptions(strFileName);
htmlLoadOptions.PageInfo.IsLandscape = false;
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(fs,htmlLoadOptions);
pdfDocument.Save(strPDFFileName);
*/

It means this exception is due to Aspose.pdf only.

@sangapankaj

Can you please try to replace strFileName to the folder path where HTML file is present and then share your kind feedback with us.

Aspose.Pdf.HtmlLoadOptions htmlLoadOptions = new Aspose.Pdf.HtmlLoadOptions("Path\to\file\");

I added below lines in my project file (.csproj file). It resolved the issue.

..\packages\System.Diagnostics.PerformanceCounter.4.5.0\lib\netstandard2.0\System.Diagnostics.PerformanceCounter.dll

@sangapankaj,

Its good to know that your issue has been resolved.