I'm using wkhtmltopdf.exe file to create PDF files from my asp.net web application. But unfortunately for certain files the process continues to run for unlimitted and the application freezes. But the same html file I was able to convert using command prompt. I really doubts there is any file size limit for the html when converting from asp.net? Is it?
Other files from the same URL working without any issue using the converter. but certain large files failed from asp.net. This is my code
Dim fileContent As Byte() = Nothing
Dim process As New System.Diagnostics.Process()
process.StartInfo.UseShellExecute = False
process.StartInfo.CreateNoWindow = True
'set the executable location
process.StartInfo.FileName = Path.Combine(Server.MapPath("~/bin/"), "wkhtmltopdf.exe")
'set the arguments to the exectuable
' wkhtmltopdf [OPTIONS]... <input fileContent> [More input fileContents] <output fileContent>
process.StartInfo.Arguments = "--margin-top 20 --margin-bottom 20 " + url + " d:\ssss\output.pdf"
process.StartInfo.RedirectStandardOutput = True
process.StartInfo.RedirectStandardError = True
process.StartInfo.RedirectStandardInput = True
'run the executable
process.Start()
'Dim output As String = process.StandardOutput.ReadToEnd()
'Dim buffer As Byte() = process.StandardOutput.CurrentEncoding.GetBytes(output)
'wait until the conversion is done
process.WaitForExit()
' read the exit code, close process
Dim returnCode As Integer = process.ExitCode
process.Close()
After WaitForExit triggers its running for unlimitted or not getting stopped and seems to be the conversion is failed.