Forums

Find answers, ask questions, and connect with our
community all around the world.

Home Forum Omnis General Forum Displaying Document Previews – with picture control?

  • Displaying Document Previews – with picture control?

    Posted by Uwe Smidt on February 27, 2023 at 10:22 am

    Dear $all,

    I am uploading files into Omnis/Postgres via the file control.

    Now, I would like to show a preview of a file in a small preview control.

    I am using the picture control – and it works fine on ‘classic’ pictures like jpg or png – but it fails on showing a preview of a PDF.

    Is there a way to display any kind of file (like in the preview of MacOS), or at least a wider range, without opening them in a separate window?

    Thanks in advance!

    Best regards

    Uwe Smidt replied 1 year, 2 months ago 2 Members · 4 Replies
  • 4 Replies
  • Götz Krija

    Member
    March 3, 2023 at 11:01 am

    Hi,

    I do not think that PDF files can be displayed in the picture control. Instead you could use the HTML control in the JS Client and the oBrowser control in the Thick Client.

    Götz

    • Uwe Smidt

      Member
      March 6, 2023 at 12:08 pm

      Hi Götz,

      Thank you for your help! I tested it, and yes, it works fine for all(?) image formats as jpg, png, svg etc, also for PDF, and even for special formats like NEF (Nikon RAW format).

      But it does not preview text files, XML, CSV, Docs etc – which would be great for what I want to do – a small Document Management system. Maybe that needs a special tool / external site etc …?

      With

      Begin statement
      Sta: <div>
      Sta: <h2>Pictures</h2>
      Sta:

      You can embed pictures.

      Sta: Test
      Sta: </div>
      End statement
      Get statement lcHTML
      Calculate $cinst.$objs.ctrHTML.$html as lcHTML

      I could display all these image files, but I needed to put them to a directory on my Web server first.<div>Is there a way to display test.pdf in ctrHTML when the file is stored in irData.File?</div><div>

      Sta: irData.File] width=”200″ height=”176″ alt=”Test” />

      did not work!

      Thanks in advance!</div><div>Uwe</div>

      • This reply was modified 1 year, 3 months ago by  Uwe Smidt.
      • Götz Krija

        Member
        March 7, 2023 at 3:08 pm

        Hi Uwe,

        So the PDF file is stored as binary? In this case you probably need to create the PDF file temporarily in the web server’s file system (e.g. by using FileOps.$createtmpfile if the Omnis server and the web server are running on the same computer).

        You can then display the PDF in the HTML control using the assignpdf $clientcommand or getpdf command.

        Please note that the pdf folder must be specified in getpdfFolders config.json item. See here: https://www.omnis.net/developers/resources/onlinedocs/WebDev/02jsremoteforms.html#setting-pdf-folders

        • Uwe Smidt

          Member
          April 3, 2023 at 8:47 am

          Dear Götz,

          Thanks for your answer.

          I had hoped for an easier and more general way to display previews of any kind of file, as in MacOS’s Finder…

          But this should work for PDFs!

Log in to reply.