maven - 使用 Maven 导入 PDF
问题描述
我正在使用 Eclipse 和 java,并且正在查看两个不同的项目(工作区 1 和工作区 2)。我正在使用 PDF 图像,试图将某些东西从 WS1 移植到 WS2。正在执行的代码是
PDDocument pdfDocument;
... // Set to a valid PDDocument
page = pdfDocument.getPage(0);
在 WS1 这工作正常。在 WS2 中,pdfDocument 没有 getPage() 方法。
我检查了 pom 文件,两者都有以下内容:
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>1.8.10</version>
</dependency>
我查看了 PDDocument 的完整路径,两者都是“org.apache.pdfbox.pdmodel.PDDocument”。
由于我使用的是 eclipse,因此我可以右键单击并打开一个定义,我在 PDDocument 的两个工作区中都这样做了:
WS1
/**
* This is the in-memory representation of the PDF document.
* The #close() method must be called once the document is no longer needed.
*
* @author Ben Litchfield
*/
public class PDDocument implements Closeable
{
private static final Log LOG =
LogFactory.getLog(PDDocument.class);
WS2:
/**
* This is the in-memory representation of the PDF document. You need to call
* close() on this object when you are done using it!!
* <p>
* This class implements the {@link Pageable} interface, but since PDFBox
* version 1.3.0 you should be using the {@link PDPageable} adapter instead
* (see <a href="https://issues.apache.org/jira/browse/PDFBOX-788">PDFBOX-788</a>).
*
* @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
* @version $Revision: 1.47 $
*/
public class PDDocument implements Pageable, Closeable
{
/**
* Log instance.
*/
如您所见,即使它们的名称相同,这些文件也是不同的。我对 maven 和 pom 文件还是有点陌生。我无法真正理解这些有何不同,或者我应该怎么做才能在 WS2 中获得正确的。我做了Maven->更新。
有人会问我要完成什么。我正在尝试获取 PDF 文件中所有图像的数组或列表或集合,以便查看文档中是否包含特定图像。这在 WS1 中运行良好。
有什么建议该怎么做吗?我想我可以给 Ben Litchfield 发电子邮件;-)
解决方案
推荐阅读
- optimization - DAX:优化 SSAS 2012 表格模型中的度量
- javascript - 无法弄清楚 parent().prev() 组合
- angular - Angular2+嵌套模块路由参数为空
- python - LSTM:如何有效理解和使用return_sequences=False?
- mysql - MySQL SELECT JOIN 在字段列表中返回未知列
- powershell - 具有多个 PowerShell 版本的 SpecialFolders
- r - 更改使用 stat_function 绘制的线的大小
- reactjs - ReactiveSearch - 无法从自动完成中强制选择(例如 strictSelection)?
- java - 2 同名的类,服务不同的目的
- html - CSS 格式不缩进 ng-repeat 输出的第二行