This is a migrated thread and some comments may be shown as answers.

Null reference Exception During Import Fixed Document

4 Answers 510 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Iron
Alexander asked on 25 Jan 2019, 02:40 PM

I use folowing function to Import Byte array into RadFixedDocument

private RadFixedDocument GetFixedDocument(byte[] Content)
{
    using (var contentStream = new MemoryStream(Content))
    {
        PdfFormatProvider formatProvider = new PdfFormatProvider(contentStream,
                                                                 FormatProviderSettings.ReadAllAtOnce);
        return formatProvider.Import();
    }
}
 

I become Nullreference Exception for Parameter Pages in Method import with following Stacktrace:

  bei Telerik.Windows.Documents.Fixed.FormatProviders.Old.Pdf.PdfReader.PdfContentManager.GetPages()
   bei Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.GetPages(RadFixedDocumentInternal doc)
   bei Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.LoadPages()
   bei Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.Import()

4 Answers, 1 is accepted

Sort by
0
Alexander
Top achievements
Rank 1
Iron
answered on 25 Jan 2019, 03:01 PM
I forgot to mention that Pdf document consists from fwo greyscaled Pictures of scanned document
0
Tanya
Telerik team
answered on 30 Jan 2019, 12:03 PM
Hi Alexander,

Such an error could be observed when the offset on which the cross-reference table start index should be present inside the document is with a wrong value. We have logged a task to handle documents which contain similar invalid offsets: Handle import of documents with invalid cross-reference table offsets. In the public item, you will find a project proposing how you could repair similar documents. Could you please check it and let me know if it fixes the issue you are observing?

Regards,
Tanya
Progress Telerik
Get quickly and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Ben
Top achievements
Rank 1
answered on 13 Feb 2019, 09:39 PM
Tanya, can I please get a link to the sample project?
0
Tanya
Telerik team
answered on 18 Feb 2019, 05:35 PM
Hi all,

I am sorry for misleading you. I attached the project in question and you can find it in the item: PdfProcessing: Handle import of documents with invalid cross-reference table offsets. Please, note that the project handles only a simple case of a cross-reference table and is not a full implementation of a repairing mechanism.

Regards,
Tanya
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
PdfProcessing
Asked by
Alexander
Top achievements
Rank 1
Iron
Answers by
Alexander
Top achievements
Rank 1
Iron
Tanya
Telerik team
Ben
Top achievements
Rank 1
Share this question
or