Fairly easy to generate pdf using Url. Here is my coe thats working:-

var exePath = @"C:\mysite\wkhtmltopdf.exe";
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = exePath;
psi.Arguments = "http://google.com" +" " + @"C:\temp\report.pdf";
Process.Start(psi);

but from the website on the same event where I am calling user control I want to generate pdf of that user control (.ascx page). How would i use it?

var exePath = "~/wkhtmltopdf.exe";
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = exePath;
psi.Arguments = "~/Controls/report.ascx" +" " + @"C:\temp\report.pdf";
Process.Start(psi);

Related posts

Recent Viewed