abcpdf

Unable to find object at PDF cross-reference stream location. (abcpdf)


I am getting below error when processing the single page pdf.

May i know why i am getting this error

Doc theSrc = new Doc(); theSrc.Read(e.FullPath); on this line

Unable to find object at PDF cross-reference stream location.

Thanks,


Solution

  • If you use ABCpdf's ExtraChecks feature that would give you the option to either try and get ABCpdf to fix the corruption, or have your own application/site issue a warning that the PDF is corrupt.

    Of course there are limits to what ABCpdf can fix - in that case you would still end receiving an error from ABCpdf.

    In terms of code, the logic would be something like this:

                    try
                    {
                        doc.Read(inFile);
                        // No corruption detected
                        doc.Save("good.pdf");
                    }
                    catch
                    {
                        try
                        {
                            doc.Read(inFile, new XReadOptions { ExtraChecks = true });
                            // ExtraChecks managed to fix the corruption
                            doc.Save("fixed.pdf"));
                        }
                        catch
                        {
                            // ABCpdf could not fix the corruption
                        }
                    }