mirror of
https://github.com/sismics/docs.git
synced 2024-11-22 22:07:56 +01:00
#4: Upgrade to unrelease PDFBox 2
This commit is contained in:
parent
44c10b60cd
commit
e72fe3683c
@ -8,7 +8,6 @@ import java.io.OutputStream;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
import javax.crypto.CipherInputStream;
|
import javax.crypto.CipherInputStream;
|
||||||
@ -16,8 +15,8 @@ import javax.crypto.CipherOutputStream;
|
|||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
import org.apache.pdfbox.pdmodel.PDPage;
|
import org.apache.pdfbox.rendering.PDFRenderer;
|
||||||
import org.apache.pdfbox.util.PDFTextStripper;
|
import org.apache.pdfbox.text.PDFTextStripper;
|
||||||
import org.imgscalr.Scalr;
|
import org.imgscalr.Scalr;
|
||||||
import org.imgscalr.Scalr.Method;
|
import org.imgscalr.Scalr.Method;
|
||||||
import org.imgscalr.Scalr.Mode;
|
import org.imgscalr.Scalr.Mode;
|
||||||
@ -159,12 +158,8 @@ public class FileUtil {
|
|||||||
PDDocument pdfDocument = null;
|
PDDocument pdfDocument = null;
|
||||||
try {
|
try {
|
||||||
pdfDocument = PDDocument.load(inputStream, true);
|
pdfDocument = PDDocument.load(inputStream, true);
|
||||||
@SuppressWarnings("unchecked")
|
PDFRenderer renderer = new PDFRenderer(pdfDocument);
|
||||||
List<PDPage> pageList = pdfDocument.getDocumentCatalog().getAllPages();
|
image = renderer.renderImage(0);
|
||||||
if (pageList.size() > 0) {
|
|
||||||
PDPage page = pageList.get(0);
|
|
||||||
image = page.convertToImage();
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
pdfDocument.close();
|
pdfDocument.close();
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<org.apache.lucene.version>4.2.0</org.apache.lucene.version>
|
<org.apache.lucene.version>4.2.0</org.apache.lucene.version>
|
||||||
<jgoodies.forms.version>1.0.5</jgoodies.forms.version>
|
<jgoodies.forms.version>1.0.5</jgoodies.forms.version>
|
||||||
<org.imgscalr.imgscalr-lib.version>4.2</org.imgscalr.imgscalr-lib.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>
|
<org.bouncycastle.bcprov-jdk15on.version>1.49</org.bouncycastle.bcprov-jdk15on.version>
|
||||||
|
|
||||||
<com.sun.grizzly.version>1.9.18-m</com.sun.grizzly.version>
|
<com.sun.grizzly.version>1.9.18-m</com.sun.grizzly.version>
|
||||||
@ -73,6 +73,18 @@
|
|||||||
<tag>HEAD</tag>
|
<tag>HEAD</tag>
|
||||||
</scm>
|
</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>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
Loading…
Reference in New Issue
Block a user