Ability to create preview pngs (for PowerPoint pages)
AnsweredWe are exploring the option to show PowerPoint page previews inside our desktop application.
My understanding of the box.com Preview API is that it's done inside an iframe. Is there any way to get box.com to return the previews as .pngs instead?
-
Hello janmechtel,
Have you seen our Preview Element JS library? https://developer.box.com/docs/box-content-preview This is the same library that powers the Preview API as well as Preview in the main Box web application. Using the library, you should be able to render a preview inline without using an iframe.
Best,
Tony
-
Because the representations are authenticated, unless you cache the representation using the same access token you give to Preview and using the same method Preview (access token either as query param or header) uses for that specific file type, the browser cache won't work since URLs may not match. Also, since we don't use pngs to display documents (we actually send a PDF representation of PowerPoint files to the client, which renders the file using pdf.js), caching pngs wouldn't help.
You can look into using the 'prefetch' function in preview.js (https://github.com/box/box-content-preview/blob/master/src/lib/Preview.js#L458) to prefetch representation content in advance, which will improve performance as long as you use the same access token you'll eventually call preview.show() with.
Please sign in to leave a comment.
Comments
3 comments