当前位置:网站首页>使用aspose-slides将ppt转pdf
使用aspose-slides将ppt转pdf
2022-06-27 09:24:00 【Sparkle_wsl】
PPT转PDF
下载jar包
链接:https://pan.baidu.com/s/1a-9zm9aaiEcemXD5jaLXRw
提取码:cu57
添加到MVN仓库中
mvn install:install-file -Dfile="jar包位置" -DgroupId="groupId" -DartifactId="artifactId" -Dversion="版本" -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true
导入依赖
<!--将ppt转pdf 这是我自己的打包方式-->
<dependency>
<groupId>aspose</groupId>
<artifactId>aspose-slides</artifactId>
<version>19.3</version>
</dependency>
代码
/** * ppt转成pdf * @param sourcePath ppt的文件路径 * @param savePath pdf保存的路径 */
public static void pptToPdf(String sourcePath,String savePath){
FileOutputStream outputStream = null;
//水印处理
final String license ="<License>\n" +
" <Data>\n" +
" <Products>\n" +
" <Product>Aspose.Total for Java</Product> \n" +
" </Products>\n" +
" <EditionType>Enterprise</EditionType>\n" +
" <SubscriptionExpiry>20991231</SubscriptionExpiry>\n" +
" <LicenseExpiry>20991231</LicenseExpiry>\n" +
" <SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>\n" +
" </Data>\n" +
" <Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature>\n" +
"</License>";
try {
//获取水印
InputStream is = new ByteArrayInputStream(license.getBytes());
com.aspose.slides.License aposeLic = new com.aspose.slides.License();
aposeLic.setLicense(is);
//读取ppt文件
FileInputStream fileInput = new FileInputStream(sourcePath);
Presentation pres = new Presentation(fileInput);
//指定输出路径
outputStream = new FileOutputStream(new File(savePath));
//输出
pres.save(outputStream, SaveFormat.Pdf);
outputStream.close();
}catch (Exception e){
e.printStackTrace();
}
}
效果
仅学习使用,非商业用途
边栏推荐
- Summary of three basic interview questions
- A classic interview question covering 4 hot topics
- How Oracle converts strings to multiple lines
- 有關二叉樹的一些練習題
- Process 0, process 1, process 2
- [vivid understanding] the meanings of various evaluation indicators commonly used in deep learning TP, FP, TN, FN, IOU and accuracy
- Semi supervised learning—— Π- Introduction to model, temporary assembling and mean teacher
- Principle and application of the most complete H-bridge motor drive module L298N
- ucore lab3
- MySQL proficient-01 addition, deletion and modification
猜你喜欢
【生动理解】深度学习中常用的各项评价指标含义TP、FP、TN、FN、IoU、Accuracy
Markem Imaje Marken IMAS printer maintenance 9450e printer maintenance
HiTek电源维修X光机高压发生器维修XR150-603-02
Creation process and memory layout of objects at JVM level
ucore lab5
I'm almost addicted to it. I can't sleep! Let a bug fuck me twice!
1098 Insertion or Heap Sort(堆排序解释)(PAT甲级)
SVN版本控制器的安装及使用方法
我大抵是卷上瘾了,横竖睡不着!竟让一个Bug,搞我两次!
Source insight 工具安装及使用方法
随机推荐
枚举?构造器?面试Demo
E+h secondary meter repair pH transmitter secondary display repair cpm253-mr0005
i=i++;
Oracle uses an SQL to find out which data is not in a table
使线程释放锁资源的操作/方法重载一点注意事项
The largest rectangle in the bar graph of force buckle 84
IO管脚配置和pinctrl驱动
Static code block vs construction code block
Quelques exercices sur les arbres binaires
CLassLoader
多個類的設計
Analysis log log
ucore lab5
ThreadLocal digs its knowledge points again
支付宝微信支付业务流程图
CLassLoader
多网络设备存在时,如何配置其上网优先级?
[system design] proximity service
ServletConfig and ServletContext
巴基斯坦安全部队开展反恐行动 打死7名恐怖分子