Change Default PDF Viewer To Custom Application

Correy Lim 1 Reputation point

Hello Microsoft Community,

(Please note I originally asked my question below here: but was instructed to post my question in this forum instead)

I have been successful in integrating PDFTron's JavaScript WebViewer library as part of my Sharepoint Online deployment by following the instructions provided here:

However, one of the questions that has come up is if we could overwrite Sharepoint Online's default behavior when clicking on the name of a PDF document.

To be clear, here is the current default behavior in Sharepoint Online:


Clicking on PDFTRON_about.pdf opens Sharepoint Online's default PDF viewer:


The requirement is to instead to be redirected to the Sharepoint Page I created and where the WebViewer JavaScript library is instantiated:


Alternatively, we could also accept an Externally Hosted Web App being opened. The other integration that we have achieved is by adding a contextual menu option for PDFs like so:


Which then opens a separate tab (currently a local development instance of our Web App), and using a combination of Query Parameters & Sharepoint Online APIs to retrieve/save documents:


Any advice on how to overwrite the default Open behavior would be greatly appreciated.

A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,868 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CaseyYang-MSFT 10,321 Reputation points

    Hi @Correy Lim ,

    Yes, PDF files always be opened in SharePoint online default view. This behavior is by default. We suggest you develop your own file handler. Otherwise, it will be handled by SharePoint or if you integrate something like Adobe Document Cloud, opened by Doc Cloud (which is still in the browser, but Adobe's service instead). In this case: How to open a PDF file in directly in PDF Viewer instead of in SharePoint? ATG-5876 provided a workaround for you reference: Checkout and Open PDF files from SharePoint Document Libraries.

    For Reference:
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.

    If an Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread