Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Sat Mar 21, 2020 3:50 pm

Hi
I'm having issues with converting some PDFs to JPEG where I'm getting "System.NullReferenceException: 'Object reference not set to an instance of an object.'" error. I have updated to the latest hotfix 6.3.0.2046. Most PDFs work fine but a subset produced by one specific application causes the error despite the page count of the loaded document showing 1. I've attached one of the offending PDF files and the exception text.

Thanks

Sample/simplified code (.NET Framework 4.7.2):
Code: Select all
Option Explicit On
Imports System.IO
Imports System.Drawing.Imaging
Imports Spire.Pdf
Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim PDFName As String = "C:\PDFTest\Asticou.pdf"
        Dim JPGName As String = "C:\PDFtest\Asticou.jpg"
        'PDFName = "C:\PDFTest\AllControls.pdf"
        'JPGName = "C:\PDFtest\AllControls.jpg"

        Dim PdfDoc As New PdfDocument()
        PdfDoc.LoadFromFile(PDFName)

        MsgBox(PdfDoc.Pages.Count)

        Using image As Image = PdfDoc.SaveAsImage(0, 200, 200)
            image.Save(JPGName, ImageFormat.Jpeg) 'make the jpeg file
        End Using
        PdfDoc.Close()
    End Sub
End Class

razmichael
 
Posts: 1
Joined: Sun Mar 08, 2020 1:41 pm

Mon Mar 23, 2020 8:32 am

Hi,

Thanks for your inquiry and sorry for the late reply as weekend.
I have reproduced the exception you mentioned and logged it into our bug tracking system with the ticket number SPIREPDF-3138. Once it is resolved or there is any update, I will inform you immediately. Sorry for the inconvenience caused.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Fri Mar 19, 2021 10:20 am

Hello,

Glad to infrom you that the bug SPIREPDF-3138 has been resoved, please download the hotfix Spire.PDF Pack(Hot Fix) Version:7.3.3 from the following link.
Website download link:https://www.e-iceblue.com/Download/download-pdf-for-net-now.html
Nuget download link: https://www.nuget.org/packages/Spire.PDF/7.3.3

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.PDF