Is there any way to get a qt web browser that can render pdf files?



  • Hello,

    I am looking for some way to get a basic web browser that can render pdf files. SO far the demos and applications I have found and tried do not render a PDF, some will let you download a pdf to the desktop though.

    I tried to get a pdf viewer plugin to work but no luck.

    Just curious if this is possible or if I should look for other solutions outside of Qt.

    Thanks,

    Tavis



  • I would find this useful too. So I searched around and found this code (assuming that you can deploy PHP in server). Of course this code is outside Qt in apache or jetty server..

    <?php

    // credits: http://yogeshchaugule.com/blog/2013/how-display-pdf-browser-php?page=1

    $file = 'path/to/PDF/filename.pdf';
    $filename = 'filename.pdf';

    header('Content-type: application/pdf');
    header('Content-Disposition: inline; filename="' . $filename . '"');
    header('Content-Transfer-Encoding: binary');
    header('Accept-Ranges: bytes');
    @readfile($file);
    ?>



  • @eureka And if this doesn't work you could use something like pdf.js (https://mozilla.github.io/pdf.js/)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.