Well this did help out, the conversion is getting farther now, but I am still getting an error. Here is the updated code:
private static byte[] ConvertDoc(Stream FileToConvert, string TempPath)
{
Aspose.Words.Document srcDoc = new Aspose.Words.Document( FileToConvert );
MemoryStream xmlDoc = new MemoryStream();
srcDoc.SaveOptions.ExportImagesFolder = TempPath;
srcDoc.Save( xmlDoc, Aspose.Words.SaveFormat.AsposePdf );
xmlDoc.Position = 0;
Aspose.Pdf.Pdf destDoc = new Aspose.Pdf.Pdf();
destDoc.BindXML( xmlDoc, null );
destDoc.IsImagesInXmlDeleteNeeded = true;
MemoryStream sPDF = new MemoryStream();
destDoc.Save( sPDF );
return sPDF.ToArray();
}
And here is the error being generated:
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Source Error:
The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:
1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
<%@ Page Language="C#" Debug="true" %>
or:
2) Add the following section to the configuration file of your application:
Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.
Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario. |
Stack Trace:
[SecurityException: Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessPermission.Demand() +59
System.Environment.GetEnvironmentVariable(String variable) +66
Aspose.Pdf.PdfText.ᅭ.ᅹ() +157
Aspose.Pdf.PdfText.ۯ.ܦ(String ܧ, String ܨ, Int32 ܩ, Boolean ܪ, Boolean ܫ, String ܬ, Boolean ܭ) +488
Aspose.Pdf.Xml.ᝨ.ᝮ(Pdf Ӛ, Section ᄬ, Table Ӫ, Row ဥ, Cell ։, Text ֏, Ӷ Ԣ, ᅣ ᅍ) +2981
Aspose.Pdf.Xml.ᗤ.ᗦ(Pdf Ӛ, Section ᄬ, Table Ӫ, Row ဥ, Cell ։, Text ֏, Ӷ Ԣ, ᅣ ᅍ, Boolean ᑀ) +19373
Aspose.Pdf.Xml.ᘐ.ᘒ(Pdf Ӛ, Section ᄢ, Ӷ Ԣ) +5497
Aspose.Pdf.Xml.ݰ.Ⴠ(Pdf Ӛ) +3965
Aspose.Pdf.Xml..(ӷ ش, Pdf Ӛ) +751
Aspose.Pdf.Pdf.Save(Stream stream) +537
mPDF.Default.ConvertDoc(Stream FileToConvert, String TempPath) +334
mPDF.Default.btnSubmit_Click(Object sender, EventArgs e) +471
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7350
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +213
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.default_aspx.ProcessRequest(HttpContext context) +4
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +358
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
|
Version Information: Microsoft .NET Framework Version:2.0.50727.1434; ASP.NET Version:2.0.50727.1434