当前位置:网站首页>使用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();
}
}
效果

仅学习使用,非商业用途
边栏推荐
- ThreadLocal digs its knowledge points again
- CLassLoader
- Object含有Copy方法?
- 三道基础面试题总结
- MATLAB小技巧(18)矩阵分析--熵权法
- Object contains copy method?
- Matlab tips (19) matrix analysis -- principal component analysis
- 多网络设备存在时,如何配置其上网优先级?
- [cloud native] 2.3 kubernetes core practice (Part 1)
- Understand neural network structure and optimization methods
猜你喜欢
![[system design] proximity service](/img/02/57f9ded0435a73f86dce6eb8c16382.png)
[system design] proximity service

win10为任意文件添加右键菜单

E+h secondary meter repair pH transmitter secondary display repair cpm253-mr0005

【生动理解】深度学习中常用的各项评价指标含义TP、FP、TN、FN、IoU、Accuracy

I'm almost addicted to it. I can't sleep! Let a bug fuck me twice!

A classic interview question covering 4 hot topics

手把手带你玩摄像头模组

Five page Jump methods for wechat applet learning

支付宝微信支付业务流程图

Principle and application of the most complete H-bridge motor drive module L298N
随机推荐
队列,双向队列,及其运用
提高效率 Or 增加成本,开发人员应如何理解结对编程?
了解神经网络结构和优化方法
ucore lab5
Chapter 11 signal (I) - concept
How do I get the STW (pause) time of a GC (garbage collector)?
Rough reading DS transunet: dual swing transformer u-net for medical image segmentation
Modify the contents of /etc/crontab file directly, and the scheduled task will not take effect
三道基础面试题总结
Tips for using Jupiter notebook
为智能设备提供更强安全保护 科学家研发两种新方法
数字IC-1.9 吃透通信协议中状态机的代码编写套路
The markdown plug-in of the browser cannot display the picture
快捷键 bug,可复现(貌似 bug 才是需要的功能 [滑稽.gif])
DV scroll board width of datav rotation table component
About the problem that the El date picker Click to clear the parameter and make it null
See how much volatile you know
JS EventListener
One week's experience of using Obsidian (configuration, theme and plug-in)
Analysis of orthofinder lineal homologous proteins and result processing