SWFTools' pdf2swf: No text converted if started from IIS-hosted website

和自甴很熟 提交于 2019-12-13 15:34:17

问题


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"

回答1:


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";



回答2:


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



来源:https://stackoverflow.com/questions/10137401/swftools-pdf2swf-no-text-converted-if-started-from-iis-hosted-website

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!