cancel
Showing results for 
Search instead for 
Did you mean: 

Register additional Mimetype conversion?

jsauer
Champ in-the-making
Champ in-the-making
Hi,
I just want to convert a tiff into a pdf file. This is possible with ImageMagick.

I added the application/pdf mime type to the web-client-config-custem.xml

    <image-transformers>
         <transformer name="application/pdf"/>
    </image-transformers>

The option will be displayed but if I try to run the action I get no Transformer registered for transformation from image/tiff to application/pdf

Do I have to change the ImageMagickContentTransformerWorker class in order to achieve this or is there another way to do it.

I already tried with RuntimeExecutableContentTransformerWorker but the explicitTransformations section seems not to do the job as I get the same resullt: no transformer for tiff to pdf 😞

As tiff and pdf mimetypes are already registered the sections in wiki http://wiki.alfresco.com/wiki/Simple_Customisations#Transformation_Mimetype and http://wiki.alfresco.com/wiki/Content_Transformations do not apply, do they?

Any ideas?
Jörg
2 REPLIES 2

zaizi
Champ in-the-making
Champ in-the-making
The code snippet from AbstractImageMagickContentTransformerWorker. You'll have to override these methods to do tiff to pdf.

    /**
     * Some image formats are not supported by ImageMagick, or at least appear not to work.
     *
     * @param mimetype the mimetype to check
     * @return Returns true if ImageMagic can handle the given image format
     */
    public static boolean isSupported(String mimetype)
    {
        if (!mimetype.startsWith(MIMETYPE_IMAGE_PREFIX))
        {
            return false;   // not an image
        }
        else if (mimetype.equals(MimetypeMap.MIMETYPE_IMAGE_RGB))
        {
            return false;   // rgb extension doesn't work
        }
        else if (mimetype.equals(MimetypeMap.MIMETYPE_IMAGE_SVG))
        {
            return false;   // svg extension doesn't work
        }
        else
        {
            return true;
        }
    }
   
    /**
     * Supports image to image conversion, but only if the JMagick library and required
     * libraries are available.
     */
    public boolean isTransformable(String sourceMimetype, String targetMimetype, TransformationOptions options)
    {
        if (!available)
        {
            return false;
        }
        if (!AbstractImageMagickContentTransformerWorker.isSupported(sourceMimetype) ||
                !AbstractImageMagickContentTransformerWorker.isSupported(targetMimetype))
        {
            // only support IMAGE -> IMAGE (excl. RGB)
            return false;
        }
        else
        {
            return true;
        }
    }

jsauer
Champ in-the-making
Champ in-the-making
Hi,
thanks for your response! Overloading is an obvious option. But I still wonder why registration in the RuntimeExecutableContentTransformer does not work? Does anybody has one on this?

I will do the overload now.

Bye
Jörg