Using pdf2htmlEx within vb net webapplication
I am trying to run the pdf2htmlEx within a vbhtml web application. It is running on IIS 8.0 (Windows 2012 server 64bit). Using the cmd line on the same server, I can easily convert the selected PDF file. If I run the EXE within .NET something strange happens. I don't get any errors and some files are actually generated but all are empty. Like somewhere in the process something goes wrong. In the eventlog there is nothing to see. No errors and no warnings.
I already checked if the application has sufficient access to the pdf2htmlEx.exe and the folder that it needs to access to get the pdf and write the html files (Full control DefaultAppPool). After 6 hours of investigating, I am a little lost and hope someone can help me. Any C# or VB code is welcome. I only can guess there is still a accessibility issue.
The output folder is generated and it only contains the following files:
- fileiuid-1.html (empty)
- fileiuid.css
- fileiuid.outline
Part of the code I am using.
@Imports System.IO
@Imports System.Diagnostics
@Code
......
Dim inputfile As FileInfo = New FileInfo(Server.MapPath("~/files/" & filerc.filename) )
Dim convertargs As String = "--tmp-dir " & Server.MapPath("~/templateshtml/tmp/") & " --embed cfijo --dest-dir " & fileiuid.tostring & " --split-pages 1 --page-filename " & fileiuid.tostring & "-%d.html " & Server.MapPath("~/templateshtml/tmp/" & filerc.filename)
Dim convertproc As Process = new Process()
convertproc.StartInfo.WorkingDirectory = Server.MapPath("~/templateshtml/")
convertproc.StartInfo.FileName = Server.MapPath("~/templateshtml/pdf2htmlEX.exe")
convertproc.StartInfo.Arguments = convertargs
convertproc.StartInfo.UseShellExecute = false
convertproc.StartInfo.CreateNoWindow = false
convertproc.StartInfo.RedirectStandardOutput = false
convertproc.Start()
convertproc.WaitForExit()
convertproc.Close()
......
End Code
Input var:
- fileiuid = 68C74B8C-1372-4077-9441-A351E5DB1429 (guid)
- filaname = test.pdf (string)