cancel
Showing results for 
Search instead for 
Did you mean: 

Transformer from ODT (open doucment format) to PDF Error

mxc
Confirmed Champ
Confirmed Champ
Hi all,

When I try and convert form an odt file to pdf using the API

   
ContentWriter writer = contentService.getTempWriter();        
ContentTransformer transformer = contentService.getTransformer(reader.getMimetype(), MimetypeMap.MIMETYPE_PDF);
….
transformer.transform(reader, writer);

I get this error.
 
limits: 
   claimed mime type: application/vnd.oasis.opendocument.text
   detected mime type: application/zip

I know odt is just a zip file but its mimetype should be part of the ziped info. Looks like the transformer is auto-detecting the mimetype incorrectly. Anyone else had this problem?
2 REPLIES 2

kaynezhang
World-Class Innovator
World-Class Innovator
Alfresco will try to use the transformer that is capable of transforming the content in your specified source mimetype(application/vnd.oasis.opendocument.text) to the your specified target mimetype(MimetypeMap.MIMETYPE_PD).
If any exception is thrown during transforming process using the transformer,alfresco will use Tika to detect the document.If the mimetype detected by tika is not the same as your reader.getMimetype(),it will report something like

claimed mime type: ****
detected mime type: ****

So please check the following two things:
1.Why the transformation using the default transformer fails,you can set logger to debug check log file.
2.Why Tika cann't detect your document correctly.

mxc
Confirmed Champ
Confirmed Champ
Thanks for the tip. Will give it a try and report back. Sorry for the delay. Real busy at the moment. Smiley Happy