Hi,
I'm having an issue when trying to convert an html file located in an local folder (the page's files is in same folder) to PDF. Here's the code I'm using:
var basePath = Path.GetDirectoryName(sourceFilePath);
if ((basePath != null) && (basePath.EndsWith("\\") == false)) basePath += "\\";
var htmlOptions = new Aspose.Pdf.HtmlLoadOptions(basePath);
var document = new Aspose.Pdf.Document(sourceFilePath, htmlOptions);
document.Save(destinationFilePath);
Where sourceFilePath is the full path to the html file and destinationFilePath is the full path of the PDF file to be saved.
When creating the document I get the following exception message:
Attempt by security transparent method 'Aspose.Pal.PalBitmap.ParseRgb(System.Drawing.Imaging.BitmapData, Boolean)' to access security critical method 'System.Runtime.InteropServices.Marshal.Copy(IntPtr, Byte[], Int32, Int32)' failed.
Assembly 'Aspose.Foundation, Version=17.4.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56' is marked with the AllowPartiallyTrustedCallersAttribute, and uses the level 2 security transparency model. Level 2 transparency causes all methods in AllowPartiallyTrustedCallers assemblies to become security transparent by default, which may be the cause of this exception.
The web page I used was saved from:
https://en.wikipedia.org/wiki/Grand_Canyon
Please help.
Regards,
Hugo.