syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [2/2] syncope git commit: Upgrading PDFBox and GreenMail
Date Mon, 21 Mar 2016 12:55:49 GMT
Upgrading PDFBox and GreenMail


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/4ede1ed1
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/4ede1ed1
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/4ede1ed1

Branch: refs/heads/master
Commit: 4ede1ed11213c8d450d0ae1e95a9a3c424ddfde6
Parents: f9af4eb
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Mon Mar 21 13:55:39 2016 +0100
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Mon Mar 21 13:55:39 2016 +0100

----------------------------------------------------------------------
 .../markup/html/form/preview/BinaryPDFPreviewer.java    | 12 +++++-------
 pom.xml                                                 |  4 ++--
 2 files changed, 7 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/4ede1ed1/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryPDFPreviewer.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryPDFPreviewer.java
b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryPDFPreviewer.java
index ed7b777..8b478a9 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryPDFPreviewer.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryPDFPreviewer.java
@@ -24,9 +24,9 @@ import java.awt.image.BufferedImage;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.Serializable;
-import java.util.List;
 import org.apache.pdfbox.pdmodel.PDDocument;
-import org.apache.pdfbox.pdmodel.PDPage;
+import org.apache.pdfbox.rendering.ImageType;
+import org.apache.pdfbox.rendering.PDFRenderer;
 import org.apache.syncope.client.console.annotations.BinaryPreview;
 import org.apache.wicket.Component;
 import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -44,9 +44,9 @@ public class BinaryPDFPreviewer extends AbstractBinaryPreviewer {
 
     private static final int IMG_SIZE = 300;
 
-    private static final int RESOLUTION = 96;
+    private static final float RESOLUTION = 96;
 
-    private static final int IMAGE_TYPE = BufferedImage.TYPE_INT_RGB;
+    private static final ImageType IMAGE_TYPE = ImageType.RGB;
 
     private transient BufferedImage firstPage;
 
@@ -64,9 +64,7 @@ public class BinaryPDFPreviewer extends AbstractBinaryPreviewer {
             if (document.isEncrypted()) {
                 LOG.info("Document is encrypted, no preview is possible");
             } else {
-                @SuppressWarnings("unchecked")
-                List<PDPage> pages = document.getDocumentCatalog().getAllPages();
-                firstPage = pages.get(0).convertToImage(IMAGE_TYPE, RESOLUTION);
+                firstPage = new PDFRenderer(document).renderImage(0, RESOLUTION, IMAGE_TYPE);
             }
         } catch (IOException e) {
             LOG.error("While generating thumbnail from first page", e);

http://git-wip-us.apache.org/repos/asf/syncope/blob/4ede1ed1/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f993445..de99fcb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1038,7 +1038,7 @@ under the License.
       <dependency>
         <groupId>org.apache.pdfbox</groupId>
         <artifactId>pdfbox</artifactId>
-        <version>1.8.11</version>
+        <version>2.0.0</version>
       </dependency>
       
       <dependency>
@@ -1257,7 +1257,7 @@ under the License.
       <dependency>
         <groupId>com.icegreen</groupId>
         <artifactId>greenmail</artifactId>
-        <version>1.4.1</version>
+        <version>1.5.0</version>
         <scope>test</scope>
       </dependency>
       <dependency>


Mime
View raw message