Calling NConvert from ASP.Net
Posted: Mon Apr 04, 2016 7:02 pm
Not sure if this has already been answered, but I have a situation in a web site where it pulls a document in TIFF format from a repository, and displays that document as a web page. This has caused problems for people with Apple Macs, because they uses "quicktime" to display the TIFF file, and it can't handle multipage TIFF documents. To me, the solution would be to convert the TIFF document on the fly to PDF - and nConvert seems the ideal solution for this. What I've tried to do is used the ASP.Net "Process Start" - the sample code is:
However, it doesn't do the Response.Redirect.
Any thoughts on the correct way to do this?
Thanks
Ken Ray
IT Solutions Architect
Clay County Clerk of the Circuit Court
Code: Select all
Dim nStartIndex = strImagePath.LastIndexOf("\") + 1
Dim strSourceFile = strImagePath.Remove(0, nStartIndex)
Dim strNconvertProgram As String = "C:\Program Files\XnView\nconvert.exe"
Dim StrNConvertArguments As String = String.Format("-c fax -multi -out pdf -o %.pdf - overwrite -quiet {0}", strImagePath)
Dim myProcess As Process = Process.Start(strNconvertProgram, StrNConvertArguments)
Dim strOutputFile As String = strSourceFile.Replace("tif", "pdf")
myProcess.WaitForExit()
myProcess.Close()
Response.Redirect(String.Format("http://inquiry.clayclerk.com/DocTemp/{0}", strOutputFile, False))
Any thoughts on the correct way to do this?
Thanks
Ken Ray
IT Solutions Architect
Clay County Clerk of the Circuit Court