网站首页 > 博客文章 正文
Aspose是什么
Aspose于2002年3月在澳大利亚悉尼创建,旗下产品覆盖文档、图表、PDF、条码、OCR、CAD、HTML、电子邮件等各个文档管理领域,为全球.NET 、Java、C ++等10余种平台开发人员提供丰富的开发选择。
Aspose.PDF for java
此链接「链接」是官方的Aspose.PDF for Java文档,包含了非常全的Java API使用示例,可以作为操作PDF的一手资料。
Aspose.PDF 操作图片
public static void processImages(String filePath) {
Document document = new Document(filePath);
for (int i = 1; i <= document.getPages().size(); i++) {
Page page = document.getPages().get_Item(i);
for (int j = 1; j <= page.getResources().getImages().size(); j++) {
XImage image = page.getResources().getImages().get_Item(j);
System.out.println(image);
// delete by image features
if (image.getWidth() == 302 && image.getHeight() == 95) {
System.out.println("delete ad image");
image.delete();
}
}
}
document.save(filePath.replace(".pdf", System.currentTimeMillis() + ".pdf"));
}
代码解析:
- 将文档解析为document对象 Document |Aspose.PDF for Java API Reference
- 从document拿到page对象 Page |Aspose.PDF for Java API Reference
- 从page拿到resource,最终拿到XImage XImage |Aspose.PDF for Java API Reference
- 通过XImage去操作,删除图片
猜你喜欢
- 2024-10-22 美国男子被自己养的大鸟杀死,他的100只神奇动物将被拍卖!
- 2024-10-22 Java 8中处理集合的优雅姿势——Stream
- 2024-10-22 Aspose.Cells 7月新版发布|支持从数字文件中读取单元格内容和样式
- 2024-10-22 Email 组件Aspose.Email V17.11发布|EWS支持编辑更新邮件的扩展属性
- 2024-10-22 Email 控件 Aspose.Email 7月新版发布|支持使用MailQuery进行分页
- 2024-10-22 Aspose.Cells新版发布-体验还原度更高的文件输出
- 2024-10-22 Aspose.BarCode新版发布条码识别更准确
- 2024-10-22 电子表格控件Aspose.Cells V17.4.0发布|新增重要功能
- 2024-10-22 Microsoft Visio 组件Aspose.Diagram V17.7发布|附下载
- 2024-10-22 java html内容 aspose生成word(java html生成word文档)
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- powershellfor (55)
- messagesource (56)
- aspose.pdf破解版 (56)
- promise.race (63)
- 2019cad序列号和密钥激活码 (62)
- window.performance (66)
- qt删除文件夹 (72)
- mysqlcaching_sha2_password (64)
- ubuntu升级gcc (58)
- nacos启动失败 (64)
- ssh-add (70)
- jwt漏洞 (58)
- macos14下载 (58)
- yarnnode (62)
- abstractqueuedsynchronizer (64)
- source~/.bashrc没有那个文件或目录 (65)
- springboot整合activiti工作流 (70)
- jmeter插件下载 (61)
- 抓包分析 (60)
- idea创建mavenweb项目 (65)
- vue回到顶部 (57)
- qcombobox样式表 (68)
- vue数组concat (56)
- tomcatundertow (58)
- pastemac (61)
本文暂时没有评论,来添加一个吧(●'◡'●)