This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git commit 7579b64653d9061d7b194f55c468f77ea9852f7e Author: jcouteau <couteau@codelutin.com> Date: Tue Jul 3 11:28:13 2018 +0200 fixes #10004 --- faxtomail-service/pom.xml | 15 ++++++++++ .../services/service/EmailServiceTest.java | 32 +++++++++++++++++++++ faxtomail-service/src/test/resources/pdf/10004.pdf | Bin 0 -> 26374 bytes faxtomail-ui-swing/pom.xml | 4 +-- pom.xml | 6 ++-- 5 files changed, 52 insertions(+), 5 deletions(-) diff --git a/faxtomail-service/pom.xml b/faxtomail-service/pom.xml index 9f712831..1ffbe3d4 100644 --- a/faxtomail-service/pom.xml +++ b/faxtomail-service/pom.xml @@ -221,6 +221,21 @@ <groupId>org.swinglabs.swingx</groupId> <artifactId>swingx-common</artifactId> </dependency> + + <dependency> + <groupId>org.apache.pdfbox</groupId> + <artifactId>pdfbox</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.pdfbox</groupId> + <artifactId>jbig2-imageio</artifactId> + </dependency> + + <dependency> + <groupId>com.twelvemonkeys.imageio</groupId> + <artifactId>imageio-jpeg</artifactId> + </dependency> </dependencies> diff --git a/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.java b/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.java index 90e4ac21..9006683a 100644 --- a/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.java +++ b/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.java @@ -45,6 +45,8 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.mail.util.MimeMessageUtils; +import org.apache.pdfbox.pdmodel.PDDocument; +import org.apache.pdfbox.rendering.PDFRenderer; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -52,8 +54,11 @@ import org.nuiton.topia.persistence.TopiaEntities; import org.nuiton.util.pagination.PaginationParameter; import org.nuiton.util.pagination.PaginationResult; +import javax.imageio.ImageIO; import javax.mail.Session; import javax.mail.internet.MimeMessage; +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -370,6 +375,33 @@ public class EmailServiceTest extends AbstractFaxToMailServiceTest { } + @Test + /** + * Test that jbig2 dependency is present so that pdf generation is correct + */ + public void test10004jbig2dependency() throws IOException { + File pdf = new File("src/test/resources/pdf/10004.pdf"); + + //Pre-generate PDF rendering + PDDocument pdDocument = PDDocument.load(pdf); + PDFRenderer renderer = new PDFRenderer(pdDocument); + + for (int i = 0; i < pdDocument.getNumberOfPages(); i++) { + BufferedImage pageImage = renderer.renderImage(i, 1.5f); + + File tempFile = File.createTempFile("10004-"+i, ".png"); + tempFile.createNewFile(); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ImageIO.write( pageImage, "png", baos ); + baos.flush(); + byte[] imageInByte = baos.toByteArray(); + baos.close(); + + Files.write(imageInByte, tempFile); + } + } + // @Test // public void testSendPdfBlanc() { // testSendEmail(""); diff --git a/faxtomail-service/src/test/resources/pdf/10004.pdf b/faxtomail-service/src/test/resources/pdf/10004.pdf new file mode 100644 index 00000000..09423882 Binary files /dev/null and b/faxtomail-service/src/test/resources/pdf/10004.pdf differ diff --git a/faxtomail-ui-swing/pom.xml b/faxtomail-ui-swing/pom.xml index 535fe33f..8ed194ad 100644 --- a/faxtomail-ui-swing/pom.xml +++ b/faxtomail-ui-swing/pom.xml @@ -280,8 +280,8 @@ </dependency> <dependency> - <groupId>com.levigo.jbig2</groupId> - <artifactId>levigo-jbig2-imageio</artifactId> + <groupId>org.apache.pdfbox</groupId> + <artifactId>jbig2-imageio</artifactId> <scope>runtime</scope> </dependency> diff --git a/pom.xml b/pom.xml index 3da7b379..06129a2d 100644 --- a/pom.xml +++ b/pom.xml @@ -787,9 +787,9 @@ </dependency> <dependency> - <groupId>com.levigo.jbig2</groupId> - <artifactId>levigo-jbig2-imageio</artifactId> - <version>1.6.5</version> + <groupId>org.apache.pdfbox</groupId> + <artifactId>jbig2-imageio</artifactId> + <version>3.0.0</version> </dependency> <dependency> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.