我正在服务模式下运行c#应用程序。我正在使用pdf2swf工具将odf格式转换为swf格式。保存在pdf中的图像正在转换。但是如果任何添加到pdf的测试没有在服务模式下转换。但当作为UI模式(Consoleapplication.exe)运行时,所有内容都会被转换。
string inputFileName = this.Filename;
string outputFileName = inputFileName.Replace("pdf", "swf");
StringBuilder sb = new StringBuilder();
sb.AppendFormat("{0} -o {1}", inputFileName, outputFileName);
string executingDirPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase).Replace("file:\\", "");
string dataDirectoryPath = Path.Combine(executingDirPath, "pdf2swf.exe");
ProcessStartInfo psi = new ProcessStartInfo(dataDirectoryPath, sb.ToString());
psi.UseShellExecute = false;
System.Diagnostics.Process pdf2swf = new System.Diagnostics.Process();
pdf2swf.StartInfo = psi;
pdf2swf.Start();
pdf2swf.WaitForExit();
pdf2swf.Close();
pdf2swf.Dispose();尊敬Sangeetha
发布于 2014-04-14 14:23:37
直接使用进程启动pdf2swf.ext可能存在权限问题,我使用了另一种方法来解决这个问题,写一个批处理文件,然后逐进程运行该批处理文件。
批处理文件示例:
c:
cd C:\Program Files (x86)\SWFTools\
pdf2swf.exe -f -T 9 -t "%1" -o "%2"程序中的代码:
Process p = new Process();
string path = basePath + "/plugin/ConvertToSwf.bat";//batch file path
ProcessStartInfo pi = new ProcessStartInfo(path, filePath + " " + swfPath);//passing the file path and converted file path to batch file
pi.UseShellExecute = false;
pi.RedirectStandardOutput = true;
p.StartInfo = pi;
p.Start();
p.WaitForExit();发布于 2014-04-14 14:10:25
最近我遇到了一个类似的问题。我通过添加一个独立的具有管理权限的控制台应用程序(Consoleapplication.exe)解决了这个问题,该应用程序在没有外壳的服务器上运行。
此外,请尝试升级到最新版本的pdf2swf。
发布于 2016-05-03 08:36:59
仅供参考。我最近遇到了这个问题(我以为是字体没有嵌入,但实际上在转换后的swf中丢失了所有文本)。对我来说修复它的是设置:
pi.UseShellExecute = false;并设置工作目录;
pi.WorkingDirectory = "C:\windows\temp"; // path where read & write ishttps://stackoverflow.com/questions/22963436
复制相似问题