mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-15 15:02:20 +00:00
MNT-16448 / REPO-928: Fix "Alfresco OOTB install doesn't show preview for .EML files"
- add back Rfc822ToPdf to replace removal of Rfc822ToSwf (removed for BDE-443) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@128822 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -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.extensions.xml.pdf.supported=true
|
||||||
content.transformer.PdfBox.TextToPdf.maxSourceSizeKBytes=10240
|
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
|
# Supports the same transformations as the previous version by using either a single
|
||||||
# ImageMagick transformation to png or two ImageMagick transformation via png.
|
# ImageMagick transformation to png or two ImageMagick transformation via png.
|
||||||
# Adobe Illustrator (ai) files are, in fact, PDF files
|
# Adobe Illustrator (ai) files are, in fact, PDF files
|
||||||
|
@@ -1,28 +1,28 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.alfresco.repo.content.transform;
|
package org.alfresco.repo.content.transform;
|
||||||
|
|
||||||
@@ -59,6 +59,8 @@ public class EMLTransformerTest extends AbstractContentTransformerTest
|
|||||||
|
|
||||||
private EMLTransformer transformer;
|
private EMLTransformer transformer;
|
||||||
|
|
||||||
|
private ContentTransformerRegistry registry;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUp() throws Exception
|
public void setUp() throws Exception
|
||||||
{
|
{
|
||||||
@@ -68,6 +70,8 @@ public class EMLTransformerTest extends AbstractContentTransformerTest
|
|||||||
transformer.setMimetypeService(mimetypeService);
|
transformer.setMimetypeService(mimetypeService);
|
||||||
transformer.setTransformerDebug(transformerDebug);
|
transformer.setTransformerDebug(transformerDebug);
|
||||||
transformer.setTransformerConfig(transformerConfig);
|
transformer.setTransformerConfig(transformerConfig);
|
||||||
|
|
||||||
|
registry = (ContentTransformerRegistry) ctx.getBean("contentTransformerRegistry");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -103,6 +107,37 @@ public class EMLTransformerTest extends AbstractContentTransformerTest
|
|||||||
assertTrue(reader2.getContentString().contains(QUICK_EML_CONTENT));
|
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
|
* Test transforming a non-ascii eml file to text
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user