Preview a PDF within AppSheet

Aurelien
Google Developer Expert
Google Developer Expert

Hi dear AppSheet Community !

The aim of this post is to describe, step by step, how to display a PDF preview. The result is an interactive dashboard with a list of files on one side, and a preview of each file on the other.

Aurelien_8-1748856082899.png

 

The trick: the XY type

 

Show More

The XY type is used to display coordinates based on an image. It is a pair of coordinates between 0 and 100.
It can be used, for example, to indicate the location of several machines on a factory layout.

Aurelien_0-1748855501798.jpeg

Here's how it works: you enter the relative coordinates on the image, and indicate which image it is.

Aurelien_1-1748855524292.png

 

In practice: exploiting XY type with a PDF

Initial assumption: we have a FILE table, with a [file] column containing a PDF file.

Step 1: Add an XY column

 

Show More

We add a column [xy], real or virtual, to this FILE table.

Aurelien_2-1748855583608.png

 

Step 2: Set up the XY column

 

Show More

Click on the black pencil attached to this column to access its options and parameters.
Look for the “Type Details” section, and enter a simple expression in the “Background image for the XY coordinates” field.

Aurelien_3-1748855613515.png

 

Step 3: Create a map view using the xy column

 

Show More

We can now create a view based on this column. This will be a Map view, for which we specify that the coordinates are the [xy] column.
As this column is empty, no marker will be displayed. However, the PDF image will be used for the background map.

Aurelien_4-1748855660805.png

 

Step 4: Create an interactive dashboard

 

Show More

Here is the trick: we create a dashboard with, on one side, a list of files, for example of the Table type, and on the other, the Map view we've just created.
Be sure to check the “Interactive” option on this view.

Aurelien_5-1748855689585.png

You can also customize the permissions and display a little to obtain a user-friendly rendering.

Aurelien_6-1748855745507.png

 

Limitations of this method

 

Show More

1) Partial cropping of preview

The PDF background is cropped in the preview, but is still displayed if the user wishes to zoom in on a cropped part.

Aurelien_7-1748855836072.png

As mentioned above, this preview only shows the first page. To see more, open the document in a new tab using AppSheet's native "Open File" action button.

2) Display delay

When PDF previews are first displayed, there may be a delay of 2 to 5 seconds. However, once displayed, the image is stored in the browser's cache and re-displayed immediately.

 

 

 

 

10 4 348
  • UX
4 REPLIES 4

Thank you @Aurelien very much for sharing a useful tip. I think such a PDF preview will be very useful in previewing documents such as certificates of various types, single page letters , packing slips , invoice etc. 

 

Aurelien
Google Developer Expert
Google Developer Expert

Thanks @Suvrutt_Gurjar yes indeed! That's a common request from my clients, hence this idea! 🙂

wow! awesome tip! thanks a lot

Thank you so much, dear @Aurelien ! It's so great to see things like this in the AppSheet community!

Top Labels in this Space