Get Page Info Javascript Pdfviewer control
The PDF Viewer library allows you to retrieves the information of a specified page in the viewer using the getPageInfo() method.This provides essential information such as the height, width and rotation.
The following steps are used to getPageInfo.
Step 1: Follow the steps provided in the link to create a simple PDF Viewer sample.
Step 2: The following code snippet to implement the functionality for retrieving height, width and rotation of a specified page in the viewer.
<button id="getPageInfo">getPageInfo</button>
document.getElementById('getPageInfo').addEventListener('click', function() {
// Set the page index for which info is required
let pageIndex=0;
// To Retrieve and log the page information
console.log(pdfviewer.getPageInfo(pageIndex));
// To Log the specific page information details to the console
const pageInfo = pdfviewer.getPageInfo(pageIndex);
console.log(`Page Info for Page Index ${pageIndex}:`);
console.log(`Height: ${pageInfo.height}`);
console.log(`Width: ${pageInfo.width}`);
console.log(`Rotation: ${pageInfo.rotation}`);
});
By following these steps, you can successfully integrate and use the get page info API in the EJ2 PDF Viewer.