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

Free Support Forum - aspose.com

Page count return wrong output in AWS instance

when I am tested in the local server it’s working filne. But in AWS It’s return wrong output.

Document document = new Document(filePath);
// for test
TxtSaveOptions options = new TxtSaveOptions();
document.save(name, options);
// file data return as a string
File outputFile = new File(name);
String base64 = null;
if (outputFile != null)
	FileInputStream fis = null;
	fis = new FileInputStream(outputFile);
	byte[] bytes = new byte[(int)outputFile.length()];
	base64 = new sun.misc.BASE64Encoder().encode(bytes);

//byte[] base64 = Base64.encodeBase64(document.getText().getBytes());
documentData.setFileData(new String(base64));
// find page count


What are the page count values you are getting on local server and on AWS?

Please also ZIP and upload your sample input document (you are getting this problem with) here for testing. We will then investigate the issue on our end and provide you more information.

test.zip (9.6 KB)
Local pageCount = 2
AWS pageCount =1


After an initial test with the licensed latest version of Aspose.Words for Java i.e. 19.2, we were unable to reproduce this issue on our end. We would suggest you please upgrade to the latest version of Aspose.Words for Java on both the local and AWS servers. Hope, this helps.