我正在使用pdfbox阅读pdf文档。 但我不能使用函数getStream for PDPage。关于文档,这个函数应该存在: https://pdfbox.apache.org/docs/2.0.0-SNAPSHOT/javadocs/
我正在使用Maven的2.0.0 Snapshot版本的PdfBox。 我已经尝试从网站下载.jar文件并使用它们而不是maven repo中的那些文件,但这也不起作用。
eclipse的确切错误是:对于PDPage类型,方法getStream()未定义。
这是pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.rwth-aachen.prime</groupId>
<artifactId>prime</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Prime Project</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.1.10.RELEASE</version>
</parent>
<repositories>
<!-- <repository> <id>libs</id> ${project.basedir} <url>file://${project.basedir}/libs</url>
</repository> -->
<!-- <repository> <id>pdfbox</id> <url>http://repository.apache.org/content/groups/snapshots</url>
</repository> -->
<!-- <repository>
<id>pdfbox</id>
<url>http://repository.apache.org/content/groups/snapshots</url>
</repository>-->
<repository>
<id>ApacheSnapshot</id>
<name>Apache Repository</name>
<url>https://repository.apache.org/content/groups/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>${spring.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- For mime type extraction -->
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
</dependency>
<!-- <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-rest-webmvc</artifactId>
<version>2.2.0.RELEASE</version> </dependency> -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.6.Final</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<!-- <version>2.4.3</version> -->
</dependency>
<dependency>
<groupId>com.voodoodyne.jackson.jsog</groupId>
<artifactId>jackson-jsog</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<!-- needed for setting lazy loaded elements = null -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-hibernate4</artifactId>
<version>2.4.4</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- Hibernate uses slf4j for logging -->
<!--<dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId>
<version>1.7.5</version> </dependency> -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.32</version>
</dependency>
<!--<dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api</artifactId>
<version>2.0.2</version> </dependency> -->
<!--<dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId>
<version>2.0.2</version> </dependency> -->
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j</artifactId>
<version>3.1.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<!-- <exclusion> <groupId>log4j</groupId> <artifactId>log4j</artifactId>
</exclusion> -->
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox-tools</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15</artifactId>
<version>1.44</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcmail-jdk15</artifactId>
<version>1.44</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>2.0.7.RELEASE</version>
</dependency>
<!-- <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency> -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
<finalName>prime</finalName>
</build>
<properties>
<java-version>1.7</java-version>
<spring.version>4.1.0.RELEASE</spring.version>
<spring.security.version>3.2.5.RELEASE</spring.security.version>
<start-class>spring.Application</start-class>
</properties>
</project>
这是mvn dependencie:tree
的结果[INFO] de.rwth-aachen.prime:prime:war:0.0.1-SNAPSHOT
[INFO] +- org.apache.tika:tika-core:jar:1.8:compile
[INFO] +- org.jsoup:jsoup:jar:1.8.1:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.3.2:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.1.10.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.1.10.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot:jar:1.1.10.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.1.10.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.1.10.RELEASE:compile
[INFO] | | | +- org.slf4j:jcl-over-slf4j:jar:1.7.7:compile
[INFO] | | | +- org.slf4j:jul-to-slf4j:jar:1.7.7:compile
[INFO] | | | +- org.slf4j:log4j-over-slf4j:jar:1.7.7:compile
[INFO] | | | \- ch.qos.logback:logback-classic:jar:1.1.2:compile
[INFO] | | | \- ch.qos.logback:logback-core:jar:1.1.2:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.13:runtime
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.3.4:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.4:compile
[INFO] | +- org.hibernate:hibernate-validator:jar:5.0.3.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.0.0:compile
[INFO] | +- org.springframework:spring-core:jar:4.1.0.RELEASE:compile
[INFO] | +- org.springframework:spring-web:jar:4.1.0.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:4.1.0.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.1.10.RELEASE:provided
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-core:jar:7.0.57:provided
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:7.0.57:provided
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:7.0.57:provided
[INFO] | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:7.0.57:provided
[INFO] +- org.springframework:spring-context:jar:4.1.0.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:4.1.0.RELEASE:compile
[INFO] | \- org.springframework:spring-beans:jar:4.1.0.RELEASE:compile
[INFO] +- org.springframework:spring-orm:jar:4.1.0.RELEASE:compile
[INFO] | +- org.springframework:spring-jdbc:jar:4.1.0.RELEASE:compile
[INFO] | \- org.springframework:spring-tx:jar:4.1.0.RELEASE:compile
[INFO] +- org.springframework:spring-expression:jar:4.1.0.RELEASE:compile
[INFO] +- org.springframework:spring-test:jar:4.1.0.RELEASE:compile
[INFO] +- org.hibernate:hibernate-core:jar:4.3.6.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] | +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] | +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.5.Final:compile
[INFO] | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] | +- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] | +- antlr:antlr:jar:2.7.7:compile
[INFO] | \- org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] +- org.apache.commons:commons-dbcp2:jar:2.0:compile
[INFO] | +- org.apache.commons:commons-pool2:jar:2.2:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:3.0.1:compile
[INFO] +- javax.servlet.jsp:jsp-api:jar:2.1:provided
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.3.4:compile
[INFO] +- com.voodoodyne.jackson.jsog:jackson-jsog:jar:1.0:compile
[INFO] +- com.fasterxml.jackson.datatype:jackson-datatype-hibernate4:jar:2.4.4:compile
[INFO] +- junit:junit:jar:4.11:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- mysql:mysql-connector-java:jar:5.1.32:compile
[INFO] +- org.docx4j:docx4j:jar:3.1.0:compile
[INFO] | +- org.plutext:jaxb-svg11:jar:1.0.2:compile
[INFO] | +- org.plutext:jaxb-xslfo:jar:1.0.1:compile
[INFO] | +- org.plutext:jaxb-xmldsig-core:jar:1.0.0:compile
[INFO] | +- net.engio:mbassador:jar:1.1.10:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.7:compile
[INFO] | +- log4j:log4j:jar:1.2.17:compile
[INFO] | +- commons-lang:commons-lang:jar:2.4:compile
[INFO] | +- commons-codec:commons-codec:jar:1.3:compile
[INFO] | +- commons-io:commons-io:jar:1.3.1:compile
[INFO] | +- org.apache.xmlgraphics:xmlgraphics-commons:jar:1.5:compile
[INFO] | +- org.apache.xmlgraphics:fop:jar:1.1:compile
[INFO] | | +- org.apache.xmlgraphics:batik-svg-dom:jar:1.7:compile
[INFO] | | | +- org.apache.xmlgraphics:batik-anim:jar:1.7:compile
[INFO] | | | +- org.apache.xmlgraphics:batik-css:jar:1.7:compile
[INFO] | | | +- org.apache.xmlgraphics:batik-dom:jar:1.7:compile
[INFO] | | | +- org.apache.xmlgraphics:batik-parser:jar:1.7:compile
[INFO] | | | \- org.apache.xmlgraphics:batik-util:jar:1.7:compile
[INFO] | | +- org.apache.xmlgraphics:batik-bridge:jar:1.7:compile
[INFO] | | | +- org.apache.xmlgraphics:batik-script:jar:1.7:compile
[INFO] | | | | \- org.apache.xmlgraphics:batik-js:jar:1.7:compile
[INFO] | | | \- org.apache.xmlgraphics:batik-xml:jar:1.7:compile
[INFO] | | +- org.apache.xmlgraphics:batik-awt-util:jar:1.7:compile
[INFO] | | +- org.apache.xmlgraphics:batik-gvt:jar:1.7:compile
[INFO] | | +- org.apache.xmlgraphics:batik-transcoder:jar:1.7:compile
[INFO] | | | \- org.apache.xmlgraphics:batik-svggen:jar:1.7:compile
[INFO] | | +- org.apache.xmlgraphics:batik-extension:jar:1.7:compile
[INFO] | | \- org.apache.xmlgraphics:batik-ext:jar:1.7:compile
[INFO] | +- org.apache.avalon.framework:avalon-framework-api:jar:4.3.1:compile
[INFO] | +- org.apache.avalon.framework:avalon-framework-impl:jar:4.3.1:compile
[INFO] | +- xalan:xalan:jar:2.7.1:compile
[INFO] | | \- xalan:serializer:jar:2.7.1:compile
[INFO] | +- net.arnx:wmf2svg:jar:0.9.0:compile
[INFO] | +- org.apache.poi:poi-scratchpad:jar:3.8:compile
[INFO] | | \- org.apache.poi:poi:jar:3.8:compile
[INFO] | +- org.antlr:antlr-runtime:jar:3.3:compile
[INFO] | \- org.antlr:stringtemplate:jar:3.2.1:compile
[INFO] +- org.apache.pdfbox:pdfbox:jar:2.0.0-SNAPSHOT:compile
[INFO] | \- org.apache.pdfbox:fontbox:jar:2.0.0-SNAPSHOT:compile
[INFO] +- org.apache.pdfbox:pdfbox-tools:jar:2.0.0-SNAPSHOT:compile
[INFO] +- org.bouncycastle:bcprov-jdk15:jar:1.44:compile
[INFO] +- org.bouncycastle:bcmail-jdk15:jar:1.44:compile
[INFO] +- org.springframework.security:spring-security-web:jar:3.2.5.RELEASE:compile
[INFO] | +- aopalliance:aopalliance:jar:1.0:compile
[INFO] | \- org.springframework.security:spring-security-core:jar:3.2.5.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-config:jar:3.2.5.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-taglibs:jar:3.2.5.RELEASE:compile
[INFO] | \- org.springframework.security:spring-security-acl:jar:3.2.5.RELEASE:compile
[INFO] +- org.springframework.security.oauth:spring-security-oauth2:jar:2.0.7.RELEASE:compile
[INFO] | \- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] \- javax.servlet:jstl:jar:1.2:compile
有人知道如何解决这个问题吗?
祝你好运