Custom widget: View PDF and ODT/ODF files directly in the browser

Hi everyone,

I’ve made a widget using the amazing viewerJS component. It enables you to view PDF and ODT/ODF files from your Grist attachments directly in the browser. You can find a working demo here.

To include the widget in your project, use the following URL: https://tomnitschke.github.io/gristwidgets/viewerjs

The source code may be found here.

Let me know how it goes. Have fun! :smiley:

3 Likes

In your demo, the ODT file works right, but the PDF viewer is not working.

I can’t scroll right or down to see the whole first page.
Fullscreen button doesn´t work either.
Only presentation button works. But after you enter presentation mode, you can´t exit it (X button doesn´t work)
Tried it with Chrome and Edge, so it doesn´t seem to be the browser.

You’re right, fullscreen and presentation mode are buggy. I’m not sure I can fix that. At least for presentation mode, you can simply select another record to get the normal view back.

As for the PDF issue, that’s because for that record, the zoom mode is set to ‘page-actual’. Try setting it to ‘auto’ instead and it should work!

ah, ok. I would have to download the document
image

so, is that column a list of options?

so, is that column a list of options?

No, it’s just text, but now you mention it, a choice field makes much more sense. I just changed it.

This is really great!

A lot of user are developing wonderful widgets.
I wish there was a centralized github repository for these experimental widgets (grist-widget-unstable?) and their documentation, to avoid losing track of all this good work.

Shall I open an issue?

4 Likes

@Emanuele_Gissi Good idea! Gets my vote!