Merge pull request #28 from sismics/master

#4: Upgrade to unrelease PDFBox 2
This commit is contained in:
Benjamin Gamard 2015-09-05 23:12:29 +02:00
commit 3d1b5a7394
2 changed files with 17 additions and 10 deletions

View File

@ -8,7 +8,6 @@ import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
@ -16,8 +15,8 @@ import javax.crypto.CipherOutputStream;
import javax.imageio.ImageIO;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.util.PDFTextStripper;
import org.apache.pdfbox.rendering.PDFRenderer;
import org.apache.pdfbox.text.PDFTextStripper;
import org.imgscalr.Scalr;
import org.imgscalr.Scalr.Method;
import org.imgscalr.Scalr.Mode;
@ -159,12 +158,8 @@ public class FileUtil {
PDDocument pdfDocument = null;
try {
pdfDocument = PDDocument.load(inputStream, true);
@SuppressWarnings("unchecked")
List<PDPage> pageList = pdfDocument.getDocumentCatalog().getAllPages();
if (pageList.size() > 0) {
PDPage page = pageList.get(0);
image = page.convertToImage();
}
PDFRenderer renderer = new PDFRenderer(pdfDocument);
image = renderer.renderImage(0);
} finally {
pdfDocument.close();
}

View File

@ -35,7 +35,7 @@
<org.apache.lucene.version>4.2.0</org.apache.lucene.version>
<jgoodies.forms.version>1.0.5</jgoodies.forms.version>
<org.imgscalr.imgscalr-lib.version>4.2</org.imgscalr.imgscalr-lib.version>
<org.apache.pdfbox.pdfbox.version>1.8.10</org.apache.pdfbox.pdfbox.version>
<org.apache.pdfbox.pdfbox.version>2.0.0-SNAPSHOT</org.apache.pdfbox.pdfbox.version>
<org.bouncycastle.bcprov-jdk15on.version>1.49</org.bouncycastle.bcprov-jdk15on.version>
<com.sun.grizzly.version>1.9.18-m</com.sun.grizzly.version>
@ -73,6 +73,18 @@
<tag>HEAD</tag>
</scm>
<repositories>
<repository>
<id>ApacheSnapshot</id>
<name>Apache Repository</name>
<url>https://repository.apache.org/content/groups/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>