Click here to Skip to main content
15,887,326 members
Please Sign up or sign in to vote.
3.67/5 (3 votes)
Hi,

I have created an asp.net c# application to convert HTML file to PDF.
For conversion I have used an external exe named wkhtmltopdf(an executable file) to convert HTML to PDF.
I used class Process to call the exe and everything is working fine.

Now I wanted to show progress bar displaying so and so percentage is completed, because converting large HTML to PDF takes time.

Reply me with how can I achieve the same.
Posted
Updated 6-May-14 2:56am
v3
Comments
Maciej Los 6-May-14 7:39am    
Re-write wkhtmltopdf file and call window with progress bar while html file is converted to pdf.<br>
What have you tried? Where are ou stuck? What's the problem?
lukeer 6-May-14 7:40am    
You have two tasks here:
1) get the information
2) display the information
Where are you stuck?
Sunasara Imdadhusen 6-May-14 8:22am    
Where is your code. does your third party code provide progress information for the same?
Muthu Nadar 6-May-14 9:05am    
Below is the code i used to call exe

var p = new System.Diagnostics.Process()
{
StartInfo =
{
FileName = pdfHtmlToPdfExePath,
Arguments = urlsSeparatedBySpaces + " " + outputFilename,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
RedirectStandardInput = true,
WorkingDirectory = outputFolder
}
};

p.Start();
var errorOutput = p.StandardError.ReadToEnd();
p.WaitForExit(60000);
p.Close();

Additionally, I have used below code to read status from the console window,
while (p.HasExited)
{
Response.Write(p.StandardOutput.ReadLine());
}
Muthu Nadar 7-May-14 4:22am    
Further I have tried using threading and Backgroundworker, but un successful

1 solution

you can achieve by these link 

 http://encosia.com/easy-incremental-status-updates-for-long-requests
 
Share this answer
 
Comments
CHill60 6-May-14 9:06am    
Surely this will only work if the 3rd party tool the OP is using provides Callbacks ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900