惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

MyScale Blog
MyScale Blog
博客园 - 叶小钗
小众软件
小众软件
宝玉的分享
宝玉的分享
Apple Machine Learning Research
Apple Machine Learning Research
Jina AI
Jina AI
Last Week in AI
Last Week in AI
量子位
腾讯CDC
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - Franky
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
有赞技术团队
有赞技术团队
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
Visual Studio Blog
爱范儿
爱范儿
月光博客
月光博客
博客园 - 三生石上(FineUI控件)
雷峰网
雷峰网
V
V2EX
WordPress大学
WordPress大学
Google DeepMind News
Google DeepMind News
阮一峰的网络日志
阮一峰的网络日志
K
Kaspersky official blog
Vercel News
Vercel News
L
LINUX DO - 热门话题
The Hacker News
The Hacker News
The Register - Security
The Register - Security
IT之家
IT之家
C
Cybersecurity and Infrastructure Security Agency CISA
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
人人都是产品经理
人人都是产品经理
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
N
News | PayPal Newsroom
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Attack and Defense Labs
Attack and Defense Labs
S
Securelist
T
The Blog of Author Tim Ferriss
GbyAI
GbyAI
Microsoft Security Blog
Microsoft Security Blog
H
Hacker News: Front Page
博客园 - 聂微东
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Project Zero
Project Zero
I
InfoQ
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
PCI Perspectives
PCI Perspectives

博客园 - mabiao008

idea更新代码时Merge和Rebase区别 CC skill Mac下载免费软件遇到问题解决 CQRS 错误码code是int类型好还是String类型好 idea2025版本破解 pgsql切换当前会话的模式 java程序中增加mongodb的联合索引 文档启动脚本报错:-bash: ./app.sh: /bin/bash^M: bad interpreter: No such file or directory Milvus索引 pandoc使用 idea把unicode转为中文 idea 插件分享 java项目无法读取resources目录下的文件 三种数据对象的区别 Linux环境aspose插件word转pdf中文乱码解决方案 java List报错Method threw ‘java.lang.UnsupportedOperationException‘ exception. 解决 java字段值为null,转json后不存在该字段对应的key 格式化json大文件 springboot项目启动报错Command line is too long. Shorten the command line via JAR manifest or via a classpath file and rerun. com.alibaba.excel.exception.ExcelGenerateException: Can not close IO linux的TCP端口问题 关于linux端口号 linux下生成pdf文件名遇到问题 把页面查询到的数据导出PDF文件(html中的在线表单下载为pdf文件)
java项目处理OFD文件
mabiao008 · 2024-11-14 · via 博客园 - mabiao008

一、导入 jar 依赖包
1.1 Maven 项目引入 jar 包

<dependency>
    <groupId>org.ofdrw</groupId>
    <artifactId>ofdrw-converter</artifactId>
    <version>2.0.2</version>
</dependency>

二、实现思路

1、直接解析ofd获取其内容,在此不多述

2、走OCR识别

1)ofd转pdf,pdf再转图片,图片走OCR识别

Path ofdPath = Paths.get("D:/ofd/1.ofd");
Path pdfPath = Paths.get("D:/ofd/target/1.pdf");
try (OFDExporter exporter = new PDFExporterPDFBox(ofdPath, pdfPath)) {
    exporter.export();
} catch (IOException e) {
    e.printStackTrace();
}

结论:出现了下述的重影问题,转PDF效果太差。所以该方案取消

2)ofd转图片,图片走OCR识别

Path ofdPath = Paths.get("D:/ofd/1.ofd");
Path imgPath = Paths.get("D:/ofd/img");
try (ImageExporter exporter = new ImageExporter(ofdPath, imgPath, "PNG", 20d)) {
    exporter.export();
} catch (IOException e) {
    e.printStackTrace();
}

结论:测试了多个ofd文件,转换图片效果较好