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

高分求ppt转pdf问题!!!在线期待期待解决
背景1:ASP.NET 下在线ppt转Pdf ,我的实现方法是引用com组件的方式去实现。目前一般的ppt是可以实现转pdf的。主要实现代码
   
public static bool PPTToPdf(string sourcePath, string targetPath, PpSaveAsFileType targetFileType)
        {
            bool result;
            object missing = Type.Missing;
            ApplicationClass application = null;
            Presentation persentation = null;
            try
            {                
                application = new ApplicationClass();
                persentation = application.Presentations.Open(sourcePath, MsoTriState.msoTrue, MsoTriState.msoFalse, MsoTriState.msoFalse);
                persentation.SaveAs(targetPath, targetFileType, Microsoft.Office.Core.MsoTriState.msoTrue);

                result = true;
            }
}

当转换有一些ppt时报如下异常“ 存储此文件时发生错误”。
背景2:该ppt我在用office2007打开的时候,选择另存为pdf的时候,在转换的过程中报错“ 存储此文件时发生错误”,网上我搜了下说问题的原因是ppt使用的字体样式在pdf中不存在,不能转换。
我的Ppt里面图片比较多的,我想问下这种情况应该怎么处理? 告诉我直接在word里面转成功的方法也行,还有如果在.NET里面应该怎么去解决这个问题?背景3(可选):我用C#代码检测了下 我的原ppt使用的字体都是pdf包括的系统字体。(也有可能我的检查代码写的不正确)
 List<string> _fontNames = new List<string>();
                foreach (PowerPoint.Slide slide in persentation.Slides)
                {
                    foreach (PowerPoint.Shape shape in slide.Shapes)
                    {
                        if (shape.HasTextFrame ==MsoTriState.msoTrue &&
                            shape.TextFrame.HasText == MsoTriState.msoTrue)
                        {
                            PowerPoint.TextRange textRange = shape.TextFrame.TextRange;