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

217

Likes

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("heigh...

Likes

Translate

Translate
Adobe Community Professional ,
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. 

Likes

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.

Likes

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`;

 

 

Likes

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