Leiste mit Community-Erfolgen erweitern.

Submissions are now open for the 2026 Adobe Experience Maker Awards.
GELÖST

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

 

 

Themen

Anhand von Themen werden Community-Inhalte kategorisiert und Sie können so relevanten Inhalt besser finden.

1 Akzeptierte Lösung

Avatar

Korrekte Antwort von
Employee

@Kiruthika_r : 

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

              window.ro.layout.numberOfPages

Lösung in ursprünglichem Beitrag anzeigen

2 Antworten

Avatar

Korrekte Antwort von
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.