首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在asp.net服务器上使用swftools pdf2swf

无法在asp.net服务器上使用swftools pdf2swf
EN

Stack Overflow用户
提问于 2013-04-01 12:20:19
回答 1查看 680关注 0票数 0

我有一个项目需要使用pdf2swf来转换pdf到swf。我在windows上使用swftool 0.9.1。文件pdf2swf.exe在上传文件夹中。我想要自动转换。我在Asp.net开发服务器上使用它。我使用以下代码:

代码语言:javascript
复制
protected void Page_Load(object sender, EventArgs e)
{
    System.Diagnostics.Process p = new System.Diagnostics.Process();

    p.StartInfo.UseShellExecute = false;

    p.StartInfo.RedirectStandardOutput = true;

    p.StartInfo.CreateNoWindow = true;

    p.StartInfo.RedirectStandardError = true;

    p.StartInfo.WorkingDirectory = HttpContext.Current.Server.MapPath("~");

    p.StartInfo.FileName = HttpContext.Current.Server.MapPath("~/upload/pdf2swf.exe");

    p.StartInfo.Arguments = " -b " + "alo.pdf" + " -o " + "alo" + ".swf";

    //Start the process

    p.Start();
    TextBox1.Text = p.StandardOutput.ReadToEnd();
    TextBox2.Text = p.StandardError.ReadToEnd();
    p.WaitForExit();
    p.Close();
}

当我在浏览器中查看此页面时,此页面显示正常,没有错误。但最重要的是文件.swf,而不是创建。请帮我解决这个问题!谢谢你的帮忙!我尝试从web应用程序运行pdf2swf。当我在浏览器中查看此页面时,字符串错误输出为: Error: open‘t open file 'alo.pdf’。但它是存在的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-04-01 20:50:57

确保p.StartInfo.WorkingDirectory指向pdf文件所在的目录。如果这些文件在上载目录中,那么它应该是:

代码语言:javascript
复制
 p.StartInfo.WorkingDirectory = HttpContext.Current.Server.MapPath("~/upload");

此属性指定pdf2swf的工作目录(默认目录,如果未指定路径,则pdf2swf将在其中搜索文件)。目前它将在HttpContext.Current.Server.MapPath("~")目录中搜索PDF文件。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15737569

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档