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.

Tue Nov 07, 2023 5:56 am

Hi,

I am using spire PDF .NET 9.10.2.0. It is excellent.
However, when I convert a pdf file to images, I have trouble using pdf.SaveImage().
The C# code snippet that I use is like as shown below:

PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile(fi.FullName);
pdf.SaveAsImage(0, PdfImageType.Bitmap, 300, 300); <- this line occurs an Exception.

The exception message means the NullReferenceException.
For your reference, I attach the error file that is a Korean pdf document.
I work on Windows 11 Pro 64-bit Korean with VS 2015 .NET 4.7.2.

Leadersdata
 
Posts: 2
Joined: Fri Nov 03, 2023 2:35 am

Tue Nov 07, 2023 7:50 am

Hi,

Thank you for your inquiry.
I test directly the pdf file you provided, and I reproduce your issue. But the root cause of this issue is related to your pdf file. When I open your pdf file without any modify then close the pdf file through the software Adobe Acrobat, a window with a save button will pop up. After clicking the save button, I tested the saved pdf file and there are no problem. I guess the software Adobe Acrobat fixed your file, so there were no problem with the saved file after testing.

Sincerely,
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Wed Nov 08, 2023 2:03 am

I know the modified file through Adobe Acrobat is processed normally. However I need to use spire PDF .NET in the automatic process. I cannot fix it manually on the fly. I am wondering if you could fix an odd pdf file automatically like Adobe Acrobat does. Or if there is any workaround on this issue.
Last edited by Leadersdata on Wed Nov 08, 2023 4:33 am, edited 1 time in total.

Leadersdata
 
Posts: 2
Joined: Fri Nov 03, 2023 2:35 am

Wed Nov 08, 2023 3:31 am

Hi,

Thank you for your inquiry.
Sorry, currently our product cannot automatically repair a strange PDF file like the software Adobe Acrobat, but we will do our best to improve it to meet every customer's needs. I have recorded this issue in our bug tracking system with the number "SPIREPDF-6390". Our development team will investigate and fix it in the future. If this issue is resolved, we will notify you as soon as possible. We deeply apologize for the inconvenience caused.

Sincerely
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Fri Dec 08, 2023 1:26 am

Hi,

Thank you for your patience.
I'm glad to inform you that we just released Spire.PDF for .Net 9.12 has resolved your issue with number SPIREPDF-6390. Welcome to download the test.

Website download link: https://www.e-iceblue.com/Download/download-pdf-for-net-now.html

Sincerely,
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Return to Spire.PDF