How to get pdf or pptx document page count

i can get word document page count by api: editor.GetDocument().GetPageCount()。API document:official api document: ONLYOFFICE

but if i call GetPageCount api in pdf or ppt page, it will will throw an error。how can i get ppt and pdf page count by office api?

Hello @isNaN

The method GetPageCount that you referring to is related to the document editor. For presentation editor you can use GetSlidesCount, but there is no such method available for PDF editor.

Thank you for your reply. If the PDF editor does not provide an API to get the number of pages in the file, is there an indirect way to achieve this? Getting the number of pages in a document is a common requirement, and many functionalities depend on this data.

I’ll take a look on alternative ways. Please await for my feedback.

1 Like

Sorry for the delayed response. Unfortunately, there is no API method that would allow getting page count in PDF API. We have registered an enhancement suggestion to implement such method in future releases of Document Server.

Sorry for the inconvenience.

thanks replay, i got it. I will try another way to get the page data, such as by call pdf.js.