Pergunta

I'm running IIS 7.5 on a Windows Server 2008 R2, and I'm trying to convert some PDFs after the upload into SWFs with SWFTools' pdf2swf. If I start the converter manually with the same arguments, everything is fine. But if I start the converter from within my HttpHandler, either the process does not return any output (and does not seem to be started at all) or converts the PDF without any text - depending on how I start the process.

Here is how I start the process:

System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = ToolsPath;
p.StartInfo.Arguments = arguments
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.Password = secPw;
p.StartInfo.UserName = username;
p.StartInfo.Domain = domain;
p.Start();
p.WaitForExit();

and which arguments I pass:

"%%source%% -o %%target%% -v -v -v -f -T 9 -t -s storeallcharacters"

Thank you very much for any help!

Edit: I also tried it without the additional StartInfo (the user-credentials), this was what I first tried, which resulted in a SWF without Text. With the credentials (as admin or standard) I do not get any SWF or output from the converter.

Edit 2: I also tried those arguments:

"%%source%% -o %%target%% -f -T 9 -t -s storeallcharacters"
Foi útil?

Solução

Okay, I solved the issue by adding a seperate console application with administrative-rights: I added an application manifest with

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

This console application called the pdf2swf.exe and is called by my HttpHandler.

Also I added to the call of the "middleman" in my HttpHandler those lines of code:

p.StartInfo.UseShellExecute = false;
if (System.Environment.OSVersion.Version.Major >= 6)
    p.StartInfo.Verb = "runas";

Outras dicas

FYI...I had a similar problem. Upgrading to the newest version pdf2swf (build 0857) fixed the problem for me.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top