Declined
Last Updated: 02 May 2025 06:24 by ADMIN
Scott
Created on: 01 May 2025 15:25
Category: Telerik Document Processing
Type: Bug Report
0
PDFFormatProvider Null Reference Exception when importing ByteArray of PDF.
When trying to pass the ByteArray as an argument to PDFFormatProvider .Import I get the following error.

PdfFormatProvider provider = new PdfFormatProvider();
 RadFixedDocument fixedDocument = provider.Import(document.ByteArray);

System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.RadFixedDocumentImportContext.BeginImportOverride()
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.BaseImportContext.BeginImport(Stream pdfFileStream)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.PdfImporter.Import(Stream input, IPdfImportContext context)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.<>c__DisplayClass19_0.<ImportOverride>b__0()
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.ExceptionHandling.ExecutionHandler.TryHandleExecution[E](Action operation)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.ImportOverride(Stream input, CancellationToken cancellationToken)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.ImportOverride(Stream input)
   at Telerik.Windows.Documents.Common.FormatProviders.FormatProviderBase`1.Import(Stream input)
   at Telerik.Windows.Documents.Common.FormatProviders.BinaryFormatProviderBase`1.Import(Byte[] input)

I have attached the PDF I'm trying to import.

1 comment
ADMIN
Martin
Posted on: 02 May 2025 06:24

Hello Scott,

Thank you for the feedback and for sharing the document with us. This helped me to successfully reproduce this unexpected behavior. It is caused by a missing "endobj" operator in the document structure.

(the third "obj" has no closing "endobj")

I logged an item on your behalf to handle such scenarios: PdfProcessing: Handle the import of documents with missing endobj operator. You can subscribe and cast your vote for the task, so we can notify you when its status changes.

As a token of appreciation for bringing this to our attention, I updated your Telerik points.

I hope you find this information helpful. Do not hesitate to contact us if any additional questions arise.

Regards,
Martin
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.