Expand my Community achievements bar.

SOLVED

How to get the total page count in PDF using JavaScript in AEM Guides

Avatar

Level 2

Hi,

 

Using the below code in page layouts, I tried to get the total page count of the PDF.

<span data-field="total-pages" data-format="default">1</span>

total page count is getting added in pdf. But can't able to fetch the value in JS. When trying to fetch the page count it's giving counter(pages) in console.

How to achieve this functionality?

Kiruthika_r_0-1706033662593.pngKiruthika_r_1-1706033669790.png

 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Employee

@Kiruthika_r : 

To get total number of pagein PDF you can use below code in Javascript&colon;

              window.ro.layout.numberOfPages

View solution in original post

2 Replies

Avatar

Correct answer by
Employee

@Kiruthika_r : 

To get total number of pagein PDF you can use below code in Javascript&colon;

              window.ro.layout.numberOfPages