diff --git a/config/alfresco/subsystems/Transformers/default/transformers.properties b/config/alfresco/subsystems/Transformers/default/transformers.properties
index de63b4ac30..ce8cfc7ca4 100644
--- a/config/alfresco/subsystems/Transformers/default/transformers.properties
+++ b/config/alfresco/subsystems/Transformers/default/transformers.properties
@@ -96,6 +96,9 @@ content.transformer.PdfBox.TextToPdf.extensions.csv.pdf.supported=true
content.transformer.PdfBox.TextToPdf.extensions.xml.pdf.supported=true
content.transformer.PdfBox.TextToPdf.maxSourceSizeKBytes=10240
+# EML to PDF
+content.transformer.complex.Rfc822ToPdf.pipeline=RFC822|txt|*
+
# Supports the same transformations as the previous version by using either a single
# ImageMagick transformation to png or two ImageMagick transformation via png.
# Adobe Illustrator (ai) files are, in fact, PDF files
diff --git a/source/test-java/org/alfresco/repo/content/transform/EMLTransformerTest.java b/source/test-java/org/alfresco/repo/content/transform/EMLTransformerTest.java
index 552725f463..b927ace1ed 100644
--- a/source/test-java/org/alfresco/repo/content/transform/EMLTransformerTest.java
+++ b/source/test-java/org/alfresco/repo/content/transform/EMLTransformerTest.java
@@ -1,28 +1,28 @@
-/*
- * #%L
- * Alfresco Repository
- * %%
- * Copyright (C) 2005 - 2016 Alfresco Software Limited
- * %%
- * This file is part of the Alfresco software.
- * If the software was purchased under a paid Alfresco license, the terms of
- * the paid license agreement will prevail. Otherwise, the software is
- * provided under the following open source license terms:
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- * #L%
- */
+/*
+ * #%L
+ * Alfresco Repository
+ * %%
+ * Copyright (C) 2005 - 2016 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ * #L%
+ */
package org.alfresco.repo.content.transform;
@@ -59,6 +59,8 @@ public class EMLTransformerTest extends AbstractContentTransformerTest
private EMLTransformer transformer;
+ private ContentTransformerRegistry registry;
+
@Override
public void setUp() throws Exception
{
@@ -68,6 +70,8 @@ public class EMLTransformerTest extends AbstractContentTransformerTest
transformer.setMimetypeService(mimetypeService);
transformer.setTransformerDebug(transformerDebug);
transformer.setTransformerConfig(transformerConfig);
+
+ registry = (ContentTransformerRegistry) ctx.getBean("contentTransformerRegistry");
}
@Override
@@ -103,6 +107,37 @@ public class EMLTransformerTest extends AbstractContentTransformerTest
assertTrue(reader2.getContentString().contains(QUICK_EML_CONTENT));
}
+ /**
+ * Test transforming a valid eml file to pdf using complex transformer ("Rfc822ToPdf") - eg. for HTML5 preview
+ */
+ public void testRFC822ToPdf() throws Exception
+ {
+ String sourceMimetype = MimetypeMap.MIMETYPE_RFC822;
+ String targetMimetype = MimetypeMap.MIMETYPE_PDF;
+
+ String sourceExtension = mimetypeService.getExtension(sourceMimetype);
+ String targetExtension = mimetypeService.getExtension(targetMimetype);
+
+ File emlSourceFile = loadQuickTestFile("eml");
+ ContentReader sourceReader = new FileContentReader(emlSourceFile);
+
+ ContentTransformer transformer = registry.getTransformer(sourceMimetype, -1, targetMimetype, null);
+ assertNotNull(transformer);
+
+ // make a writer for the target file
+ File targetFile = TempFileProvider.createTempFile(getClass().getSimpleName() + "_"
+ + getName() + "_" + sourceExtension + "_", "." + targetExtension);
+ ContentWriter targetWriter = new FileContentWriter(targetFile);
+
+ // do the transformation
+ sourceReader.setMimetype(sourceMimetype);
+ targetWriter.setMimetype(targetMimetype);
+ transformer.transform(sourceReader.getReader(), targetWriter);
+
+ ContentReader targetReader = new FileContentReader(targetFile);
+ assertTrue(targetReader.getSize() > 0);
+ }
+
/**
* Test transforming a non-ascii eml file to text
*/