Counting number of pages in word document / number of slides in PPT

Hi All,

I am looking for a API which would return me the number of pages of a word document on my remote server or number of slides in a ppt before converting them.

As it depends which format i convert depending upon the above parameters.

Are there any API which can help me build something like this. Thanks.


Thanks for your interest in Aspose products. You can get number of pages in Word document by using the Document.PageCount property of Aspose.Words for .NET API. I think, with Aspose.Slides for .NET API, you can get number of slides in a ppt file. I am moving your thread in Aspose.Slides forum where you’ll be guided appropriately.

Best regards,


I would respond to your query from Aspose.Slides perspective.

You can use Presentation.Slides.Count property to get the number of slides in a presentation. Please see the following sample code in this regard:

Presentation pres = new Presentation("C:\\Data\\HelloWorld.pptx");

int slideCount = pres.Slides.Count;

In case you need any further assistance, please feel free to contact support.

Thanks & Regards,

Hi My programming Language is PHP, is there any API for PHP or may be Java or Javascript

Also My requirement is to just get the Number of pages and Number odf Slides nothing more than that.

What would be the best approach.


I am afraid. currently the support for COM interface to use Aspose.Slides with other programming languages like PHP etc is not available. An issue with issue id: SLIDESNET-30297 has already been created in our issue tracking system to support this feature.

However, you can use the following sample code to get the Slides Count using Aspose.Slides for Java.

//Instantiate the PresentationEx class and open a PPTX file

PresentationEx pres = new PresentationEx("input.pptx");

int SlideCount = pres.getSlides().getCount();

Another option you can consider is to use Aspose.Slides for Cloud API. You can use it with PHP as well. Also, as your requirement is to only get the slide counts, it might be cost effective solution for you. You can check the following documentation link for details and sample code regarding how to get slide count using Aspose.Slides for Cloud API.

My colleague will respond to your query from Aspose.Words perspective soon.

Thanks & Regards,

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}



As far as Aspose.Words is concerned, you can go for any of the following options.

  1. If you want to use Aspose.Words for .NET in PHP, you can use following code to get number of pages in PHP. Please check these topics for more details.
$comHelper = new COM("Aspose.Words.ComHelper");
echo $doc->PageCount;
  1. If you want to use Aspose.Words for Java, document.getPageCount() API will give you number of pages. Please check

  2. You can use Aspose.Words for Cloud in any platform or language. Please check Aspose.Words Cloud - API References
    Best Regards,