We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Get Accurate Page Count from Word Document on Different Linux Ubuntu Distributions (Machines) using Java | Install & Set Fonts Location

Hi,

com.aspose.words.Document doc = new com.aspose.words.Document(path);
System.out.println(String.format(“com.aspose.words.Document(%s).getPageCount=%s”, org.apache.commons.io.FilenameUtils.getName(path), doc.getPageCount()));

I run the program with this code in several machines. Only my machine get correct results same as MS-Words. All machines use Linux with different distributions, my machine use Ubuntu 18.04 but other machine with same OS as mine still get wrong number. And all use JAVA 8 and above, only my machine use Oracle JDK, others use Open JDK. I tried to change JDK and it’s not work.
Is there a way to fix this? Please advise.

Regards
Screenshot from 2020-09-10 16-43-45.png (197.7 KB)
2020-08-25-13.45.01.832_102.zip (3.3 MB)

@rcomniscien,

Most likely, problem occurs because of missing fonts. Please just copy fonts from your machine (or from a Windows machine) to other machines. Please refer to the following articles for more details:

After installing the required fonts used in Word DOCX files, Aspose.Words for Java should return correct page counts.

1 Like

That’s work! Thank you!