asp.net将ppt文档转换成pdf
一、添加引用
using Microsoft.Office.Core;
using Microsoft.Office.Interop.PowerPoint;
二、转换方法
///<summary>
/// 把PowerPoint文件转换成PDF格式文件
///</summary>
///<param name="sourcePath">源文件路径</param>
///<param name="targetPath">目标文件路径</param>
///<returns>成功返回true,失败返回false</returns>
public static bool PPTConvertToPDF(string sourcePath, string targetPath)
{
bool result;
PpSaveAsFileType ppSaveAsFileType = PpSaveAsFileType.ppSaveAsPDF;//转换成pdf
object missing = Type.Missing;
Microsoft.Office.Interop.PowerPoint.ApplicationClass application = null;
Presentation persentation = null;
try
{
application = new Microsoft.Office.Interop.PowerPoint.ApplicationClass();
persentation = application.Presentations.Open(sourcePath, MsoTriState.msoTrue, MsoTriState.msoFalse, MsoTriState.msoFalse);
if (persentation!=null)
{
persentation.SaveAs(targetPath, ppSaveAsFileType, MsoTriState.msoTrue);
}
result = true;
}
catch
{
result = false;
}
finally
{
if (persentation != null)
{
persentation.Close();
persentation = null;
}
if (application != null)
{
application.Quit();
application = null;
}
}
return result;
}
三、调用
OfficeToPdf.PPTToPDF("d:\\12345。pptx", "d:\\12345。pdf");
asp.net将ppt文档转换成pdf的更多相关文章
- ASP.NET将word文档转换成pdf的代码
一.添加引用 using Microsoft.Office.Interop.Word; 二.转换方法 1.方法 C# 代码 /// <summary> /// 把Word文件转换成pdf文 ...
- C#实现文档转换成PDF
网上有很多将doc.ppt.xls等类型的文档转换成pdf的方法,目前了解到的有两大类: 1.使用虚拟打印机将doc.ppt.xls等类型的文档 2.使用OFFICE COM组件 我采用了第二种方法实 ...
- word ppt excel文档转换成pdf
1.把word文档转换成pdf (1).添加引用 using Microsoft.Office.Interop.Word; 添加引用 (2).转换方法 /// <summary> /// ...
- Python将word文档转换成PDF文件
如题. 代码: ''' #將word文档转换为pdf文件 #用到的库是pywin32 #思路上是调用了windows和office功能 ''' #导入所需库 from win32com.client ...
- Java利用aspose-words将word文档转换成pdf(破解 无水印)
首先下载aspose-words-15.8.0-jdk16.jar包 http://pan.baidu.com/s/1nvbJwnv 引入jar包,编写Java代码 package doc; impo ...
- Java实现批量将word文档转换成PDF
先导入words的jar包 需要jar包的私聊我发你 代码如下:import com.aspose.words.Document;import java.io.File; public class W ...
- C#调用WPS将文档转换成pdf进行预览
引用:https://www.jianshu.com/p/445996126c75 vs启动项目可以生成wps实例 本地iis部署的站点却不行 原因是vs是管理员权限,而iis没有权限 解决方法 启动 ...
- C# word文档转换成PDF格式文档
最近用到一个功能word转pdf,有个方法不错,挺方便的,直接调用即可,记录下 方法:ConvertWordToPdf(string sourcePath, string targetPath) so ...
- java将office文档pdf文档转换成swf文件在线预览
第一步,安装openoffice.org openoffice.org是一套sun的开源office办公套件,能在widows,linux,solaris等操作系统上执行. 主要模块有writer(文 ...
随机推荐
- 20135119_涂文斌 实验三 敏捷开发与XP实践
北京电子科技学院(BESTI) 实 验 报 告 课程: Java 班级:1351 姓名:涂文斌 学号:20135119 成绩: ...
- 冲刺Two之站立会议2
今天我们进行了主界面部分的设置,因为它包含的部分有很多,所以就只能它拆分进行一一突破.今天主要完成了主界面的框架搭建,以及添加了需要的按钮,包括好友管理,退出登录,开启聊天通信界面的内容等.
- Leetcode——37.解数独 [##]
@author: ZZQ @software: PyCharm @file: leetcode37_solveSudoku.py @time: 2018/11/20 16:41 思路:递归回溯 首先, ...
- canvas实现五子棋界面
1.获取canvas画布 var canvas = document.getElementById('canvas'); var context = canvas.getContext('2d'); ...
- Linux基础二(挂载、关机重启与系统等级)
一.Linux 基础之挂载 1. 挂载和查询 1.1 挂载 什么叫挂载?装系统的时候要给硬盘分区,在 Windows 中要分 C 盘 D 盘 DEF 盘,这个操作我们叫做分配盘符,分配盘符之后我们就可 ...
- 为elasticSearch开发c++接口
一. ElasticSearch是什么 ElasticSearch是目前开源全文搜索引擎的首选,可以快速存储,搜索和分析海量数据.Stack Overflow,Github等都在使用. Elas ...
- poi中如何自定义日期格式
1. poi的“Quick Guide”中提供了 “How to create date cells ”例子来说明如何创建日期单元格,代码如下: HSSFCellStyle cellStyle = w ...
- SSR & Next.js & Nuxt.js
SSR & Next.js & Nuxt.js Server Side Rendering https://nextjs.org/ https://nuxtjs.org/ SSR &a ...
- python中 除了if else def class 有作用域 其余没有作用域
python中 除了if else def class 有作用域 其余没有作用域
- 【设计模式】—— 策略模式Strategy
前言:[模式总览]——————————by xingoo 模式意图 定义一系列的算法,把他们封装起来,使得算法独立于适用对象. 比如,一个系统有很多的排序算法,但是使用哪个排序算法是客户对象的自有.因 ...

///<summary>
/// 把PowerPoint文件转换成PDF格式文件
///<returns>成功返回true,失败返回false</returns>
{
}