Getting class com.aspose.pdf.exceptions.CrossTableNotFoundException


I am getting the below error in our production environment. This is happening when we are validating pdf pages by checking the pdfpage height and weight. It fails on the following line

float pageWidth = Math.round(pdfFile.getPageWidth(i+1));
class com.aspose.pdf.exceptions.CrossTableNotFoundException:
Cross reference table or cross refference stream not found

com.aspose.pdf.internal.p21.z29.m3(Unknown Source)

com.aspose.pdf.internal.p21.z29.m2(Unknown Source)

com.aspose.pdf.internal.p21.z29.m1(Unknown Source)

com.aspose.pdf.PageCollection.getUnrestricted(Unknown Source)

com.aspose.pdf.PageCollection.m1(Unknown Source)

com.aspose.pdf.PageCollection.get_Item(Unknown Source)

com.aspose.pdf.facades.PdfFileInfo.getPageWidth(Unknown Source)

Can you please help me in understanding what can be the reason for the above error.


Hi Carol,

Thanks for your our API’s.

Please see below sample code for you reference, It doesn’t throw any exception.


PdfFileInfo info = new PdfFileInfo("/Users/fahadadeel/Downloads/resources/inputdocument.pdf");
int pageCount = info.getNumberOfPages();
for (int i = 1; i <= pageCount; i++) {
float pageWidth = Math.round(info.getPageWidth(i));

If you are still facing issues, please share your sample project / code along with your input PDF document for further investigation.

Best Regards,