pdfviewer cannot load table 'invalid cross reference table'

a previous thread (winforms) reported a similar error

https://www.syncfusion.com/forums/157886/loading-pdf-throws-exception-invalid-cross-reference-table

it was suggested that there was a dependency missing syncfusion.compression.net

I have updated all nuget packages but still receive this error on a variety of pdfs with tables and form

at first I thought it was because the template files (pdf) contained xfa form fields but it does not seem to be that. I have had pdfs opeing and been able to edit but that seems to have reverted to this 'corssreference table' error with latest 25.2.6

herewith code 

mypdfv.LoadDocument(fs);

mypdfv.ZoomFactor = 2.5;
mypdfv.IsEnabled = true;
mypdfv.DocumentLoaded += Mypdfv_DocumentLoaded;
mypdfv.DocumentLoadFailed += Mypdfv_DocumentLoadFailed;
 private void Mypdfv_DocumentLoadFailed(object? sender, DocumentLoadFailedEventArgs? e)
 {
     Console.WriteLine("Mypdfv_DocumentLoadFailed: " + e.Message);
     DisplayAlert("Error", "failed to load PDF template \n" + e.Message, "OK");


 }


 private void Mypdfv_DocumentLoaded(object? sender, EventArgs? e)
 {
     int fieldCount = mypdfv.FormFields.Count;
     Console.WriteLine("fieldCount: " + fieldCount);
     copygartopdf();
    // setfieldpdfv(mypdfv, "Registration", "2-OFUS");
 }



and heres a couple of pdfs which report the error

Attachment: GenDeclatest2_c353dffb.zip

3 Replies

DR Deepika Ravi Syncfusion Team May 30, 2024 05:18 PM UTC

Hi john murray,


We tried to replicate the reported issue with the provided details. The exception occurs when loading the shared document in SfPdfViewer. However, the document loaded properly without any exception on our side. We have attached a sample along with the output screenshot for your reference. It can be downloaded from the attachment.


If you are still able to replicate the issue in the shared sample, kindly modify the reproducing issue in the shared sample and share the updated sample with us. This will be helpful for us to provide a prompt solution at earliest.


Regards,

Deepika R


Attachment: Fourm188467_f5fea573.zip


JM john murray May 31, 2024 11:47 AM UTC

I got round problem by copying pdf into Word document changes some fields and saving it from word to a pdf. It seems (because this has happened before) that sfPdfviewer takes exception to some files

I am no expert in pdf and frankly I havent got the time to run to ground sfPdfviewer's invalid cross reference table error but thanks for looking at it 

I maintain there is still an error in SFPdfviewer asa it seems to have happened before on xamarin (see previous mentioned thread) and once again you could not reproduce it.  So I'll live with my workaround. tx again 



MM Manikandan Manickavasagam Syncfusion Team June 4, 2024 04:03 AM UTC

Hi Jhon,


I'm glad to hear that copying the PDF into a Word document, making changes, and saving it as a
new PDF resolved the issue. Sometimes the problem may lie with the PDF itself. If you other PDFs with the same issue, could you please share them with us? This information will be helpful for us to check further on our end.

Regards,
Manikandan M


Loader.
Up arrow icon