Does anyone know a way to embed an non-editable preview (like a print preview) of a odf writer document existing on the hard drive of the app host into a Java Swing GUI interface ?
            Asked
            
        
        
            Active
            
        
            Viewed 358 times
        
    2
            
            
        - 
                    2Use http://www.jopendocument.org/ library. – jdiver May 11 '14 at 15:15
 - 
                    Googling `opendocument odf java swing` will get you most any and all information that you would need. Note that this question is off topic as it is asking about 3rd party libraries. – Hovercraft Full Of Eels May 11 '14 at 15:18
 - 
                    jopendocument.org has a library which unfortunately only previews .ods documents (spreadhsheet files). @Hovercraft Full Of Eels: interestingly enough searching "Java Swing preview odf" returns this as first result, kind of a circle isn't it? :) – sarah.ferguson Sep 28 '15 at 09:13
 
1 Answers
1
            
            
        Simple: the format ODF is a zip file with inside a folder Thumbnails with thumbnail.png.
With java.util.zip no problem.
You can even try immediately with an URL "jar:file:///... .odt!/Thumbnails/thumbnail.png". Worked for me. I am afraid such a thumbnail is optional though. 
        Joop Eggen
        
- 107,315
 - 7
 - 83
 - 138
 
- 
                    thank you! i just tried it but didn't find in the unzipped output the thumbnail unfortunately, seems you were right about saying it ain't a default file to have there – RedCH May 11 '14 at 15:52
 - 
                    I tried it on Libre Office (under Linux), with a brand new document. Thanks, for the feedback; it seems not _that_ simple. – Joop Eggen May 11 '14 at 17:13
 - 
                    I actually found the thumbnail but it is such low res that I doubt it can be of any real use. – sarah.ferguson Sep 28 '15 at 09:15
 - 
                    @sarah.ferguson yes too tiny; a text excerpt on base of content.xml is best. – Joop Eggen Sep 28 '15 at 10:20