내 커뮤니티 업적 표시줄을 확대합니다.

Submissions are now open for the 2026 Adobe Experience Maker Awards.
해결됨

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

 

 

주제

토픽은 커뮤니티 콘텐츠를 분류하여 관련성 있는 콘텐츠를 찾는 데 도움이 됩니다.

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Employee

@Kiruthika_r : 

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

              window.ro.layout.numberOfPages

원본 게시물의 솔루션 보기

2 답변 개

Avatar

정확한 답변 작성자:
Employee

@Kiruthika_r : 

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

              window.ro.layout.numberOfPages

Avatar

Level 2

Thanks @DivrajSingh. This solution works fine.