日期:2014-05-17  浏览次数:21160 次

将pdf转换为swf的中文乱码问题
简单地将pdf转换为swf后发现中文的地方都变成了空白,在自己的测试网站中加了xpdf-chinese-simplified,后中文可以正常显示。但是把他放到系统中,发不到服务器就仍然中文的地方为空白,
string fileName = file.XFL_FILE_NAMEDisplayValue;
                            string cmdStr = HttpContext.Current.Server.MapPath("/workflows/SWFTools/pdf2swf.exe");
                            string path = string.Format("/workflows/{0}/{1}/", ConfigUtility.ResourceFilesVirtualPath, file.XFL_IDDisplayValue);
                            string savePath2 = HttpContext.Current.Server.MapPath(path);
                            string lagpath = @"""" + HttpContext.Current.Server.MapPath("/workflows/SWFTools/xpdf-chinese-simplified") + @"""";
                            // @"""" 相当于一个双引号,之所以要加@"""" 就是为了防止要转换的过程中,文件夹名字带有空格,导致失败
                            string sourcePath = @"""" + savePath2 + fileName + @"""";
                            string targetPath = @"""" + savePath2 + fileName.Substring(0, fileName.LastIndexOf(".")) + ".swf" + @"""";
                            string argsStr = "  -t " + sourcePath + " -s languagedir=" + lagpath + " -s flashversion=9 -o " + targetPath;
                            ExecuteCmd(cmdStr, argsStr);
                            FileURL = path + fileName.Substring(0, fileName.LastIndexOf(".")) + ".swf";



配置
#----- begin Chinese Simplified support package (2011-10.27)
cidToUnicode    Adobe-GB1    C:\YIBIYI\SourceCodes\workflows\SWFTools\xpdf-chinese-simplified\Adobe-GB1.cidToUnicode
unicodeMap    ISO-2022-CN     C:\YIBIYI\SourceCodes\workflows\SWFTools\xpdf-chinese-simplified\ISO-2022-CN.unicodeMap
unicodeMap    EUC-CN        C:\YIBIYI\SourceCodes\workflows\SWFTools\xpdf-chinese-simplified\EUC-CN.unicodeMap
unicodeMap    GBK        C:\YIBIYI\SourceCodes\workflows\SWFTools\xpdf-chinese-simplified\GBK.unicodeMap
cMapDir        Adobe-GB1 &nb