首页 新闻 会员 周边

服务器pdf转swf 转换后数据不全。

0
悬赏园豆:10 [已关闭问题] 关闭于 2015-10-13 09:05

遇到一个很奇怪的问题,在本机开发环境下生成word、使用FlexPaper浏览都是可以的。 大家可能知道,word需要转换成pdf,pdf要转换成swf才能查看。 

本地:

 

把代码发布到服务上后。PDF转换swf就出先问题了。 word转PDF是可以的,看文件是全的。就是PDF转swf出现了问题。 请大神帮忙分析下是什么原因造成的。

 

 

转换代码如下:

        /// <summary>
        /// 将pdf文件转化为swf文件,文件名称不变
        /// </summary>
        /// <param name="pdf2swfPath">pdf2swfPath工具所在路径</param>
        /// <param name="PdfPath">pdf存储路径</param>
        /// <param name="PdfName">pdf文件名称</param>
        /// <param name="destPath">swf存储路径</param>
        /// <returns></returns>
        public static string PdfToSwf(string pdf2swfPath, string PdfPath, string PdfName, string destPath)
        {
            string fullPathName = PdfPath + PdfName;//包含 路径 的全称
            string fileNameWithoutEx = System.IO.Path.GetFileNameWithoutExtension(PdfName);//不包含路径,不包含扩展名
            string extendName = System.IO.Path.GetExtension(PdfName).ToLower();//文件扩展名
            string saveName = destPath + fileNameWithoutEx + ".swf";
            string returnValue = fileNameWithoutEx + ".swf"; ;
            if (extendName != ".pdf")
            {
                returnValue = "";
            }
            else
            {
                Util.PDFToSWF(pdf2swfPath, fullPathName, saveName);
            }
            return returnValue;
        }

 

 /// <summary>
        /// 把PDF文件转化为SWF文件
        /// </summary>
        /// <param name="toolPah">pdf2swf工具路径</param>
        /// <param name="sourcePath">源文件路径</param>
        /// <param name="targetPath">目标文件路径</param>
        /// <returns>true=转化成功</returns>
        public static bool PDFToSWF(string toolPah, string sourcePath, string targetPath)
        {
            Process pc = new Process();
            bool returnValue = true;

            string cmd = toolPah;
            string args = " -t " + sourcePath + " -s flashversion=9 -o " + targetPath;
            try
            {
                ProcessStartInfo psi = new ProcessStartInfo(cmd, args);
                psi.WindowStyle = ProcessWindowStyle.Hidden;
                pc.StartInfo = psi;
                pc.Start();
                pc.WaitForExit();
            }
            catch (Exception ex)
            {
                returnValue = false;
                throw new Exception(ex.Message);
            }
            finally
            {
                pc.Close();
                pc.Dispose();
            }
            return returnValue;
        }
最初的、天空的主页 最初的、天空 | 初学一级 | 园豆:40
提问于:2015-10-12 15:07
< >
分享
所有回答(1)
0

缺少字体包.可以下载字体包之后在参数里面 (输入-s 可以看到参数.) 设置字体包的路径.就好了.

月亮那么僵 | 园豆:166 (初学一级) | 2018-01-15 09:31
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册