algoo / preview-generator

generates previews of files with cache management
https://pypi.org/project/preview-generator/
MIT License
235 stars 51 forks source link

What dependencies are needed to preview Apple Keynote/Numbers/Pages documents? <eom> #180

Open rkiesler1 opened 4 years ago

rkiesler1 commented 4 years ago

Looks like it's trying to open the .key file as an archive: PreviewGenerator:__init__:21 - INFO: New Preview builder of class<class 'preview_generator.preview.builder.archive__zip.ZipPreviewBuilder'> However, both get_jpeg_preview and get_pdf_preview fail for .key files

inkhey commented 4 years ago

Hello, Thanks for reporting us this issue. It's possible that a wrong preview builder is used. Do you have some .key file sample, to help us fix this ?

rkiesler1 commented 4 years ago

sample_keynote.key.zip

ZIP file contains a .key file

inkhey commented 4 years ago

Thanks, I check, and like https://github.com/algoo/preview-generator/issues/183, we get trouble with mimetype detection mecanism. It's also seems that support for keynote is far from perfect in LibreOffice (keynote preview are generated with libreoffice).

So, you now can workaround theses issues by:

  1. use this piece of code, which will force .key to be always considered as keynote file:
    from preview_generator.extension import mimetypes_storage
    mimetypes_storage.add_type(
    'application/vnd.apple.keynote', '.key')
  2. If the preview generated is not correctly rendered, try installing latest version of Libreoffice.