Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Oct 11, 2021 09:41 AM
Hi Airtable community,
I am stumped with a bit of an annoying task here. We have an attachment field in our Airtable base where we attach DOCX files. We want to return this field as a part of an API response from our custom API, and we want to do a full preview of the DOCX as an image, to be served to our website. I know the endpoint returns a thumbnail image, but this is pretty small and blurry. I was wondering if there was a way to fetch a larger thumbnail, or a full page preview, of the DOCX file from Airtable’s API.
If anybody knows of how to figure this out, in any way possible, I would greatly appreciate it. Thank you!
Jack Tilly
Oct 11, 2021 12:52 PM
An idea for you is that you could return the url for the .docx file via the API and then render it in an iframe on your front end using Microsoft or google’s browser viewer. I have not tested this and you may have to play around with it a bit but it could look something like this:
<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=http://remote.url.tld/path/to/document.doc' width='1366px' height='623px' ></iframe>
Oct 12, 2021 05:24 AM
That is a great idea. Half of the reason for doing this as it is a “preview”, and we really don’t want the user being able to have access to the file itself, but I can mess around with the idea and see if theres a way to hide the document itself from public access.
Oct 12, 2021 05:52 AM
Ah I see.
The browser viewer would be read only but I don’t think you would be able to stop a user from finding the source url and downloading the .docx file.
The Airtable thumbnails are not really decent enough quality to actually read a document. Perhaps it would be best to either save the .docx file as an image and keep that in a separate field to serve to the user. Or use an API service like cloudmersive to return an image format of document. That kind of parsing should probably be done before the request of a user though as I’m sure load times would be awful.