Aspose for .Net Version 7.7: PdfConverter.BindPdf(stream) throwing Object Reference not set to Instance of an Object Exception

Issue: We are normally daily convert a lot of PDF to Tiff using Aspose library. Last week we received a new PDF file from another source and tried to convert it to TIFF and it failed with the below exception.

Class: PdfConverter

Method: PdfConverter.BindPdf

Version: 7.7

Exception: Object Reference not Set to Instance of an Object

Platform: .net 3.5

Technical detail of issue:

  1. We read the pdf file in FileStream and create an object fileToConvert that we use to convert-
  2. We try to Convert using PdfConverter.BindPdf(stream) method and it fails with an exception Object Reference not set to Instance of an object. This only occurs on some files and not others.

Interestingly when I open the pdf file that does not convert and save it again using Adobe Acrobat and convert the newly saved file I do not produce the exception.

var pdfMs=new MemoryStream();

var msStream=new MemoryStream(fileToConvert.File);

var pdfConverter=new PdfConverter();

pdfConverter.Resolution=new Aspose.Pdf.Devices.Resolution(tiffResolution);

var tiffSettings = new TiffSettings();

tiffSettings.Depth = ColorDepth.Format1bpp;

tiffSettings.Compression = CompressionType.CCITT4;

pdfConverter.BindPdf(msStream); Error Happens

pdfConverter.DoConvert();

I’ve checked the forums and found a similar issue in the PdfExtractor class. I’m guessing the exception occurs in the Facade super class? It was mentioned that this Ticket PDFNEWNET-35069 was created and later remediated in release 8.2. When I checked the release notes for 8.2 I did not see this Ticket appear. Could someone from Aspose please confirm if this Exception was indeed remediated?

Also please confirm if this fix remediated PDFConvertor.bindPdf error. Thank you!

For reference: NullReferenceException generated by PdfExtractor.BindPdf() - Aspose.PDF Product Family - Free Support Forum - aspose.com

@loganfetterly

We are afraid that the API versions you are mentioning are quite older and we are not really maintaining our logs for them. Additionally, a lot functionality has been removed or modified since then. Our recommendation is always use the latest version of the API because it has maximum fixes and improvements.

Furthermore, yes, the referenced ticket was fixed in 8.2 version of the API but regretfully, we cannot use that version to perform any tests for you as they are outdated. You can however perform tests at your end and upgrade the API to the latest version in case issues occur. However, please feel free if you are facing any issue while using the latest version of the API. We will proceed further to assist you accordingly.

1 Like