I'm trying to convert single asp.net page to pdf. Based on my research, most of people said that it can be done using wkhtmltopdf. I tried to used but facing some problem. Hope you guys can help me with this.
string myDocumentsPath = "C:\\Users\\Downloads\\wkhtmltopdf.exe ";
ProcessStartInfo psi = new ProcessStartInfo(myDocumentsPath, "
http://localhost/ViewResume.aspx");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardError = true;
psi.CreateNoWindow = true;
Process myProcess = Process.Start(psi);
myProcess.WaitForExit();
myProcess.Close();
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=abc.pdf");
Response.ContentType = "application/pdf";
Response.WriteFile("D:\\bb.pdf");
Response.End();
The error that I'm getting is :-
The requested operation requires elevation
Description: An unhandled exception occurred during the execution of the current web
request.
Exception Details: System.ComponentModel.Win32Exception: The requested operation
requires elevation
Stack Trace:-
[Win32Exception (0x80004005): The requested operation requires elevation]
System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) +1959
System.Diagnostics.Process.Start() +145
System.Diagnostics.Process.Start(ProcessStartInfo startInfo) +49
FinalDen_ViewResume.Button1_Click(Object sender, EventArgs e) in
c:\Users\Samba\Desktop\New folder\FinalDen(latest)\FinalDen\ViewResume.aspx.cs:144
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent
(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String
eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint) +5563
Hope anyone can help me with this. TQ