[Guide] How to configure the PDF Viewer in Workshop using datasets?

How to configure the PDF Viewer in Workshop using datasets

The use case is simple: You have a directory with different files you want to sync and display in foundry using some sort of Direct Connection (SharePoint, S3, Blob, etc.)

You now need to display a specific file using the PDF Viewer widget in Workshop. The official documentation provides clues, but not all of it is straightforward. Here’s a quick guide to save you time and avoid trying out multiple possibilities.

Configure PDF Sourcing Options

To display a PDF in the PDF Viewer, you need to select the media source. The dropdown will offer you the supported media sources available, including:

  1. Compass: Uses Palantir’s file system to display PDFs.

    • Blobster RID: Provide the string variable for the Blobster RID of the desired PDF.
  2. Dataset: Use a dataset as the media source for PDFs.

    • Dataset RID: A string variable that specifies the RID of the dataset containing the desired PDF.
    • File Path: The file path within the dataset of the PDF.
    • Branch: The branch ID for the dataset. If not specified, the default is the master branch.
  3. Media References

  4. Attachments
    These last two can also be used, but the steps for using datasets are the most useful when dealing with synced files from external sources.

For more details, you can refer to the official documentation:
PDF Viewer in Workshop Docs

How to Configure the PDF Viewer Using Datasets

Here’s how to configure it specifically for using files synced from external sources

1. Obtain the Dataset RID

Once you’ve synced your files (from SharePoint, S3, Blob, etc.), a dataset will be created in Foundry. The dataset URL will look something like this:

https://<your_subdomain>.palantirfoundry.com/workspace/data-integration/dataset/preview/ri.foundry.main.dataset.aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/master

You’re jsut interested in the RID part of it:

ri.foundry.main.dataset.aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/master

2. File Path

If you preview the file you should see something like this:


(paths are hidden)

The file path is the exact name of each file INSIDE the resulting dataset you’re connecting to after the sync. This is the part that always gets me confused.

Your widget should look like this:

2 Likes