I found the cause of problem because I use JRSwapFileVirtualizer in java code. The virtualizer will cut the jasper print into different files to avoid out of memory exception and save them on the hard drive and/or compress it, so the total page cannot to calculate because I set maxSize parameter to be 100 pages . Integer virtualPage = 100;new JRSwapFileVirtualizer(virtualPage, swapFile);[/code]If you want to read more about virtulizers in JasperReports, you can go to this link: virtualizers-jasperreports