• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How get page width and height?

Explorer ,
Sep 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

How get page width and height?

 

 

TOPICS
How to , PDF Embed API

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Sep 22, 2020 Sep 22, 2020
I did this and it works, at the end of `await apis.getPageZoom(1)` it returns zoom `1`. But as I opened this PDF file in another viewer it's 100% bigger.
 
PDF Embed API confuses 100% for 75%. Now I don't know if it does this with every PDF file?
If with everyone then I can just do

 

const view100ProcentWidth =(viewWidth/zoom) + (viewWidth/zoom)/3 + scrollbarWidth​;

 

and get a real 100% zoom.

 

 

Code that takes width and sets 100% width:

 

document.querySelector("#adobe-dc-view").style.setProperty("height
...

Votes

Translate

Translate
Community Expert ,
Sep 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

You can't currently get the page dimensions with Embed API. What exactly are you trying to accomplish? There might be a work around. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

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...

 

Then I could calculate the zoom and height to know how to position the container so that the document has a 100% zoom.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 22, 2020 Sep 22, 2020

Copy link to clipboard

Copied

LATEST
I did this and it works, at the end of `await apis.getPageZoom(1)` it returns zoom `1`. But as I opened this PDF file in another viewer it's 100% bigger.
 
PDF Embed API confuses 100% for 75%. Now I don't know if it does this with every PDF file?
If with everyone then I can just do

 

const view100ProcentWidth =(viewWidth/zoom) + (viewWidth/zoom)/3 + scrollbarWidth​;

 

and get a real 100% zoom.

 

 

Code that takes width and sets 100% width:

 

document.querySelector("#adobe-dc-view").style.setProperty("height", "50px");
const zoom = await apis.getPageZoom(1);
document.querySelector("#adobe-dc-view").style.removeProperty("height");
const viewWidth = document.querySelector("#adobe-dc-view").clientWidth-scrollbarWidth;
const view100ProcentWidth = (viewWidth/zoom)+scrollbarWidth;
console.log("view100ProcentWidth",view100ProcentWidth);
document.querySelector("#adobe-dc-view").style.width = `${view100ProcentWidth}px`;

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources