Skip to main content
Inspiring
September 18, 2020
Answered

How disable scrollbar when `embedMode: "FULL_WINDOW"`?

  • September 18, 2020
  • 2 replies
  • 2554 views

How disable scrollbar when `embedMode: "FULL_WINDOW"`?

This topic has been closed for replies.
Correct answer look997

It is impossible to hide the scrollbar, but you can get the scrollbar size and count it:

function getScrollbarWidth () {

// Creating invisible container
const outer = document.createElement('div');
outer.style.visibility = 'hidden';
outer.style.overflow = 'scroll'; // forcing scrollbar to appear
outer.style.msOverflowStyle = 'scrollbar'; // needed for WinJS apps
document.body.appendChild(outer);

// Creating inner element and placing it in the container
const inner = document.createElement('div');
outer.appendChild(inner);

// Calculating difference between container's full width and the child width
const scrollbarWidth = (outer.offsetWidth - inner.offsetWidth);

// Removing temporary elements from the DOM
outer.parentNode.removeChild(outer);

return scrollbarWidth;

}

source: https://stackoverflow.com/a/13382873/2908501

2 replies

look997AuthorCorrect answer
Inspiring
September 22, 2020

It is impossible to hide the scrollbar, but you can get the scrollbar size and count it:

function getScrollbarWidth () {

// Creating invisible container
const outer = document.createElement('div');
outer.style.visibility = 'hidden';
outer.style.overflow = 'scroll'; // forcing scrollbar to appear
outer.style.msOverflowStyle = 'scrollbar'; // needed for WinJS apps
document.body.appendChild(outer);

// Creating inner element and placing it in the container
const inner = document.createElement('div');
outer.appendChild(inner);

// Calculating difference between container's full width and the child width
const scrollbarWidth = (outer.offsetWidth - inner.offsetWidth);

// Removing temporary elements from the DOM
outer.parentNode.removeChild(outer);

return scrollbarWidth;

}

source: https://stackoverflow.com/a/13382873/2908501

Joel Geraci
Community Expert
Community Expert
September 18, 2020

There is no programmatic control of the scroll bar at this time. What exactly are you trying to achieve? There might be a way to accomplish your goal in another way.

look997Author
Inspiring
September 18, 2020

I want do this:
https://community.adobe.com/t5/document-services-apis/how-set-zoom-100/m-p/11442696#M683

and ultimately this:

https://community.adobe.com/t5/document-services-apis/pdf-embed-api-get-screenshot/m-p/11428290?page=1#M646

 

As for this topic, I can turn off the scrollbar or somehow to deduct it from the width of the container with the document (here comes the problem of recognizing whether the scrollbar is in the document at all).

Joel Geraci
Community Expert
Community Expert
September 18, 2020

Let me try this another way. Assuming this is even possible, once you have the screen shot, what do you want to do with it?