Я пытаюсь преобразовать одну страницу asp.net в pdf. Основываясь на моих исследованиях, большинство людей говорили, что это можно сделать с помощью wkhtmltopdf. Я попытался использовать, но столкнулся с некоторыми проблемами. Надеюсь, вы, ребята, можете мне помочь.Преобразование кода Asp.net в pdf с помощью wkhtmltopdf
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 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
Трассировка стека: -
[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
Надежда кто-нибудь может мне помочь с этим. TQ
Что такое трассировка стека? – SLaks
@SLaks, я включил трассировку стека в вопросе –
@NOORMOHAMED вы передаете выходной путь к программе? Я вижу только один аргумент, который я бы предположил, это входная страница, но не выходной путь. Еще одна мысль –