PageHeight and PageWidth Values


I am trying to get the values of PageHeight and PageWidth so i can save in variables .
After having these variables with the size of PageHeight and PageWidth i want to set components right in the top left corner of the screen. So it will be something like this

Position X = - ( Page.getWidth() divided by 2 );
Position Y = -( Page.getHeight() divided by 2 );

But the values are always returning 0 or auto…


        console.log("Device model: " + platformModule.device.model);
        console.log("Device type: " + platformModule.device.deviceType);
        console.log("OS: " + platformModule.device.os);
        console.log("OS version: " + platformModule.device.osVersion);
        console.log("SDK Version: " + platformModule.device.sdkVersion);

        console.log("Screen width: " + platformModule.screen.mainScreen.widthPixels);
        console.log("Screen height: " + platformModule.screen.mainScreen.heightPixels);
        console.log("Screen scale: " + platformModule.screen.mainScreen.scale);

        console.log("Page Height: " +;
        console.log("Page width: " +;



The values of screen width and Screen height i think they’re incorrect.

According to a conversion of pixels into centimeters. 2560 pixels are 67centimeters, and my physical cellphone doesnt have 67 centimeters of height.
Can someone help me out?


How exactly are you converting pixels into cms? Different screens have different pixel density, or PPI (pixels per inch/ PPCM - pixels per centimeter)

Here’s a calculator you may find handy -


I used an online calculator. But even on that Calculator you linked me the values seem wierd…


I am still around this PageHeight and PageWidth Values thing…
What i want to do is get the actual value of PageHeight and PageWidth on my Typescript file. Then Pass this to HTML code so i define my component to have the PageHeight and PageWidth Values.

Another approach: Can i on my .css file get the PageWith and PageHeight Values or on HTML instead of being on the TypeScript File?


CSS and HTML are both used to describe a look, they do not make computations. Both are declarative languages, and cannot do anything about the control flow. TypeScript will be the way to go.

You could try debugging the application using Chrome, and inspecting the computed style for Page, it may give you an idea of what the effective height/width are.