Thread "PDF file preview in browser"

Tabs

  • Deleted
    Deleted | 12. May 2022, 16:20
    PDF file preview in browser
    Hello everyone,

    I am trying to enable browser preview for uploaded PDF files. When I go on Repository and Objects > Files > Settings, pdf format seems to be enabled for preview (see first attachment). In the "Preview Renderers" tab I get a notification about configuring Ghostscript (see second attachment), however from what I can tell Ghostscript is installed and configured correctly on the server. Meanwhile pdf files download directly on click instead of opening in browser view. I'm not sure if I'm missing some setting I need to enable when uploading files. Any help is appreciated.
  • utesche
    utesche | utesche | 13. May 2022, 07:03
    Edited on: 13. May 2022, 07:04 - by utesche | utesche
    Re: PDF file preview in browser

    Hello franc_rusha,

    (A) "ghostscript"
    you did not state which ILIAS version you are using, but I guess it's v7, right?
    If so, check the path setting to 'ghostscript' in your "Installation Status":

    by GUI:
    Administration >> System Settings and Maintenance >> General Settings >> Server >> Installation Status

    by CLI;
    > php setup/cli.php status


    ... you should get something like:

    ghostscript.png

    Otherwise, you have to supply the path to YOUR  ghostscript binary via your 'config.json' and perform an update - see: README.md.


    (B) "download instead of viewing"
    The "Preview for PDF mentioned above" is just an optional, quite small popup window.

    ILIAS by itself does NOT have a builtin PDF viewer, but your browser may:
    Depending on your personal settings in your browser, when your browser gets a PDF-datastream returned from a webserver (identified by its mime type), the browser may:

    1. display the PDF in the browser tab
    2. make a downloaded file out of the datastream
    3. open a configured external application to open the received file
    4. or:  always asks you what to do with a certain PDF data stream

    Obviously, your browser profile setting currently is:  option 2 ...

    wbr,
    Uwe

  • Deleted
    Deleted | 22. Jul 2022, 13:31
    Re: PDF file preview in browser
    As we have had troubles with the in-browser PDF preview recently, I'll just leave our problem and solution here:

    After upgrading from ILIAS 5.4 to ILIAS 7, we've found that pre-update PDFs were causing an error message in the file preview ("Fehler beim Laden des PDF Dokuments").
    The cause of the problem was, that pre-update PDFs had the value "mime_type" in the table il_resource_info set to "unknown". A quick SQL-query to update this value for all PDFs from "unknown" to "application/pdf" resolved the issue.