Free Support Forum - aspose.com

PDF reading error: CrossTableNotFoundException

Hello,

I try to read a PDF file using Aspose.PDF for Java 18.3, and I get the following traceback:

Exception in thread "main" class com.aspose.pdf.exceptions.CrossTableNotFoundException: Cross reference table or cross refference stream not found
com.aspose.pdf.internal.l4l.I41.lI(Unknown Source)
com.aspose.pdf.PageCollection.size(Unknown Source)
com.aspose.pdf.PageCollection.l1(Unknown Source)
com.aspose.pdf.PageCollection.<init>(Unknown Source)
com.aspose.pdf.ADocument.l1If(Unknown Source)
com.aspose.pdf.ADocument.lif(Unknown Source)
com.aspose.pdf.ADocument.<init>(Unknown Source)
com.aspose.pdf.Document.<init>(Unknown Source)
src.PDFMain.main(PDFMain.java:11)
        at com.aspose.pdf.internal.l4l.I41.lI(Unknown Source)
        at com.aspose.pdf.PageCollection.size(Unknown Source)
        at com.aspose.pdf.PageCollection.l1(Unknown Source)
        at com.aspose.pdf.PageCollection.<init>(Unknown Source)
        at com.aspose.pdf.ADocument.l1If(Unknown Source)
        at com.aspose.pdf.ADocument.lif(Unknown Source)
        at com.aspose.pdf.ADocument.<init>(Unknown Source)
        at com.aspose.pdf.Document.<init>(Unknown Source)
        at src.PDFMain.main(PDFMain.java:11)

I guess that the file I try to open is not entirely valid, as it is not openable by Acrobat Reader 2017, however it opens in Mozilla Firefox (using Adobe PDF plugin). Still, we get multiple files like this from a publisher (I have around 70 files with this problem), so we’d like to know if there is a reason that Aspose cannot process them, or it can be fixed in further versions.

My code is as follows:

    package src;
    
    import com.aspose.pdf.Document;
    import com.aspose.pdf.License;
    
    public class PDFMain {
    
        public static void main(String[] args) throws Exception {
            License l = new License();
            l.setLicense("Aspose.Total.Java.lic");
            Document doc = new Document("file1.pdf");
        }
        
    }

A sample PDF file that causes this problem is file1.pdf.

Thanks!

@shutovich

Thank you for contacting support.

We have worked with the data shared by you and have been able to reproduce the issue. An investigation ticket with ID PDFNET-44485 has been logged in our issue management system for further investigation and resolution. The issue ID has been linked with this thread so that you will receive notification as soon as the issue is resolved.

Moreover, the exception does not occur if you open the problematic file with Firefox and then print it to a PDF file using ‘Microsoft Print to PDF’. Neither Acrobat Reader, nor Aspose.PDF API face any problem while loading that file. So you may follow this workaround approach to avoid the issue until it is investigated in our environment.

We are sorry for the inconvenience.