# How to enable this option by default in pdfjs-express-viewer

**URL:** <https://pdfjs.community/t/how-to-enable-this-option-by-default-in-pdfjs-express-viewer/1455>\
**Category:** Technical Support\
**Tags:** pdfjs-express\
**Created:** [March 8, 2022, 5:52pm UTC](https://pdfjs.community/t/how-to-enable-this-option-by-default-in-pdfjs-express-viewer/1455 "2022-03-08T17:52:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![stsantosyasociados](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@stsantosyasociados](https://pdfjs.community/u/stsantosyasociados)\
**Post date:** [March 8, 2022, 5:52pm UTC](https://pdfjs.community/t/how-to-enable-this-option-by-default-in-pdfjs-express-viewer/1455/1 "2022-03-08T17:52:14Z")

</div>

hello everygone I use in react js pdf viewer free and need to for default active to option that points in the image that I uploaded

/_version_/  
^8.2.1

 ![Captura](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/3db4be43a1f4259e0362653a6658b3cd8c40e7da.png)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/ffbcd25c7d423db8d5acd5db201c272f4db306dd.png) [@system](https://pdfjs.community/u/system)\
**Post date:** [March 8, 2022, 5:52pm UTC](https://pdfjs.community/t/how-to-enable-this-option-by-default-in-pdfjs-express-viewer/1455/3 "2022-03-08T17:52:19Z")

</div>

**Hello, I’m Ron, an automated tech support bot 🤖**

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:
- [Integrating React with PDF.js Express Viewer JavaScript PDF library - Prerequisites](https://pdfjs.express/documentation/get-started-viewer/react#prerequisites)
- [Integrating PDF.js Express Viewer into a new Blazor project - Prerequisites](https://pdfjs.express/documentation/get-started-viewer/blazor/new-project#prerequisites)
- [Adding your license key - PDF.js Express Viewer License Keys](https://pdfjs.express/documentation/get-started/add-license-key#pdf.js-express-viewer-license-keys-<span-class='viewer'></span>)

APIs:
- [PDF.js Express Utilities](https://pdfjs.express/api/utils/index.html#__anchor)
- [Core - enableFullPDF()](https://pdfjs.express/api/Core.html#.enableFullPDF__anchor)
- [Adding a download button](https://pdfjs.express/api/utils/tutorial-Adding%20a%20download%20button.html#__anchor)

Forums:
- [‘instance’ is not defined](https://pdfjs.community/t/instance-is-not-defined/1302/1)
- [The active licence key is not working](https://pdfjs.community/t/the-active-licence-key-is-not-working/1099/1)
- [License key for viewer is not working in an ionic app](https://pdfjs.community/t/license-key-for-viewer-is-not-working-in-an-ionic-app/1436/1)

---

<div class="post-metadata">

**Author:** ![dnavarro](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/dnavarro/32/707_2.png) [@dnavarro](https://pdfjs.community/u/dnavarro)\
**Post date:** [March 8, 2022, 6:22pm UTC](https://pdfjs.community/t/how-to-enable-this-option-by-default-in-pdfjs-express-viewer/1455/4 "2022-03-08T18:22:03Z")

</div>

Hi There,

Here is a ticket with a similar question.

> [@Force tool button panToolButton starting enabled by default](https://pdfjs.community/t/force-tool-button-pantoolbutton-starting-enabled-by-default/1449/4):
>
> Hi Luigi, Thanks for your question. Here is a code snippet to help you enable the panToolButton. import WebViewer from '@pdftron/pdfjs-express-viewer' WebViewer({ ...options }).then(instance =\> { const { Tools } = instance.Core; const panTool = Tools.ToolNames.PAN; instance.UI.setToolMode(panTool); }) Hope this helps and let me know if this approach works for you. Thank you, Dandara

Hope this helps and let me know if this works for you.

Thank you,

Dandara

---

<div class="post-metadata">

**Author:** ![stsantosyasociados](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@stsantosyasociados](https://pdfjs.community/u/stsantosyasociados)\
**Post date:** [March 8, 2022, 7:51pm UTC](https://pdfjs.community/t/how-to-enable-this-option-by-default-in-pdfjs-express-viewer/1455/5 "2022-03-08T19:51:41Z")

</div>

hello i use to code to sample and it does not work

```javascript
 useEffect(() => {
    WebViewer(
      {
        licenseKey: "nkrJM83iXlKQYjD8wPcX",
        path: "/webviewer/lib",
        initialDoc:
          "https://firebasestorage.googleapis.com/v0/b/pruebas-juridicapp-abogados.appspot.com/o/Abogados%2FwPMnKZMLVYRp1fUSJDfEKMTVMVn1%2Fcasos%2F6zYAk2A5enNRnjV8abWW%2FDocumentos%2Fdocumento1_.pdf?alt=media&token=325b1cc0-9d3b-474e-b6ad-e0325dfc7228",
      },
      viewer.current
    ).then((instance) => {
      // now you can access APIs through the WebViewer instance
      const { Core } = instance;
      /*change lenguage */
      instance.UI.setLanguage("es");

      const panTool = Core.Tools.ToolNames.PAN;
      instance.UI.setToolMode(panTool);

      // remove left panel and left panel button from the DOM
      instance.UI.disableElements([
        "textSelectButton",
        "selectToolButton",
        "searchButton",
        "printButton",
      ]);

      /*disable Functions */
      instance.disableFeatures([instance.Feature.Print]);
      instance.disableFeatures([instance.Feature.TextSelection]);
      instance.disableFeatures([instance.Feature.Copy]);
      instance.disableFeatures([instance.Feature.FilePicker]);

      // adding an event listener for when a document is loaded
      Core.documentViewer.addEventListener("documentLoaded", () => {
        console.log("document loaded", instance.Feature);
      });

      // adding an event listener for when the page number has changed
      Core.documentViewer.addEventListener(
        "pageNumberUpdated",
        (pageNumber) => {
          console.log(`Page number is: ${pageNumber}`);
        }
      );
    });
  }, []);

```

---

<div class="post-metadata">

**Author:** ![dnavarro](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/dnavarro/32/707_2.png) [@dnavarro](https://pdfjs.community/u/dnavarro)\
**Post date:** [March 9, 2022, 4:54pm UTC](https://pdfjs.community/t/how-to-enable-this-option-by-default-in-pdfjs-express-viewer/1455/6 "2022-03-09T16:54:20Z")

</div>

Hi There,

Please try to use the following code.

```javascript
useEffect(() => {
    WebViewer(
      {
        licenseKey: "nkrJM83iXlKQYjD8wPcX",
        path: "/webviewer/lib",
        initialDoc:
          "https://firebasestorage.googleapis.com/v0/b/pruebas-juridicapp-abogados.appspot.com/o/Abogados%2FwPMnKZMLVYRp1fUSJDfEKMTVMVn1%2Fcasos%2F6zYAk2A5enNRnjV8abWW%2FDocumentos%2Fdocumento1_.pdf?alt=media&token=325b1cc0-9d3b-474e-b6ad-e0325dfc7228",
      },
      viewer.current
    ).then((instance) => {
      // now you can access APIs through the WebViewer instance
      const { Core } = instance;

    /* disable Functions */
    instance.disableFeatures([instance.Feature.Print]);
    instance.disableFeatures([instance.Feature.TextSelection]);
    instance.disableFeatures([instance.Feature.Copy]);
    instance.disableFeatures([instance.Feature.FilePicker]);

    /*change language */
    instance.UI.setLanguage("es");

    const panTool = Core.Tools.ToolNames.PAN;
    instance.UI.setToolMode(panTool);

    // remove left panel and left panel button from the DOM
    instance.UI.disableElements([
      "textSelectButton",
      "selectToolButton",
      "searchButton",
      "printButton",
    ]);

    // adding an event listener for when a document is loaded
    Core.documentViewer.addEventListener("documentLoaded", () => {
      console.log("document loaded", instance.Feature);
    });

    // adding an event listener for when the page number has changed
    Core.documentViewer.addEventListener(
      "pageNumberUpdated",
      (pageNumber) => {
        console.log(`Page number is: ${pageNumber}`);
      }
    );
  });
  }, 
[]);

```

I changed the code execution order a bit and it worked on my side.

Let me know if this works for you.

Thank you,  
Dandara
