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.

Wed Jul 22, 2020 12:43 pm

Hi.

Using the ExtractText() method as we always use it without problems, in a particular file (attached) it triggered the null reference error:

Code: Select all
NullReferenceException
em spr⌒.ᜀ(String A_0, String A_1, Boolean A_2, Boolean A_3)
em spr❓.ᜅ()
em spr❓..ctor(String A_0, ᜁ A_1, ᜁ A_2, spr❛ A_3, sprⅤ A_4, spr❚ A_5, Double A_6, Double A_7, spr❊ A_8, ᜂ A_9)
em spr❈.ᜅ(String A_0, ᜁ A_1, ᜁ A_2, spr❛ A_3, sprⅤ A_4, spr❚ A_5, Double A_6, Double A_7, spr❊ A_8, ᜂ A_9)
em spr❛.ᜃ(Int32 A_0, Int32 A_1, spr⌕ A_2, spr❊ A_3)
em spr❛.ᜃ(ᜁ A_0)
em spr❛.ᜊ(Int32 A_0, spr⌕ A_1)
em spr❛.ᜇ()
em spr❝.ᜀ(spr⌖ A_0, sprℵ A_1)
em spr❝.ᜀ()
em spr❝..ctor(PdfPageBase A_0, spr❗ A_1, Boolean A_2)
em spr❝..ctor(PdfPageBase A_0, spr❗ A_1)
em spr❖.ᜃ(PdfPageBase A_0)
em spr㉅.ᜀ(PdfPageBase A_0, Boolean A_1, Rectangle A_2)
em Spire.Pdf.PdfPageBase.ExtractText(Boolean keepWhiteSpace)
em Spire.Pdf.PdfPageBase.ExtractText()
em EMAILFrameworkComgas.RecepcionarEmailComgas.ProcessarFaturaComgas(ConcreteComponentAgenda pAgenda, EMail pEMail, MemoryStream pMemoryStream, String pNomeDoArquivo) na C:\Development\Solutions\SLNFrameworkComgas\EMAILFrameworkComgas\RecepcionarEmailComgas.cs:linha 119
em EMAILFrameworkComgas.RecepcionarEmailComgas.ProcessarEMail(EMail pEMail, Int64 pUID) na C:\Development\Solutions\SLNFrameworkComgas\EMAILFrameworkComgas\RecepcionarEmailComgas.cs:linha 207
em BLLeitorDeEmails.CaixaDeRecepcao.RecepcionarEmail(IMail pIMail, Int64 pUID) na C:\Development\Solutions\SLNLeitorDeEmails\BLLeitorDeEmails\CaixaDeRecepcao.cs:linha 239


The code utilized is:
Code: Select all
using (FileStream myFileStream = new FileStream("DocumentWithProblem.pdf", FileMode.Open))
{

   try
   {
      PdfDocument myPdfDocument = new PdfDocument(myFileStream);

      foreach (PdfPageBase myPdfPageBase in myPdfDocument.Pages)
      {
         String TextExtracted = myPdfPageBase.ExtractText();
      }
   }
   catch (Exception e)
   {
      String Error = e.Message;
   }
}


Thank for your help.

RuiBarbosa
 
Posts: 19
Joined: Thu Apr 18, 2019 12:23 pm

Thu Jul 23, 2020 10:17 am

Hello,

Thanks for your post.
I tested your case with the latest version (Spire.PDF Pack(Hot Fix) Version:6.7.8) but did not reproduce your exception. If you were using an older version, please download the latest version and try again. If your issue still occurs, to help further look into it. Please share us with your system information (E.g. Win7, 64 bit) and region setting (E.g. China, Chinese) for reference.

Sincerely,
Sofia
E-iceblue support team
User avatar

Sofia.Yang
 
Posts: 84
Joined: Tue Jul 14, 2020 1:41 am

Thu Jul 23, 2020 2:35 pm

Sofia,

thanks for your help.

Updating the version, the problem was fixed. Everything is fine now.

Regards

RuiBarbosa
 
Posts: 19
Joined: Thu Apr 18, 2019 12:23 pm

Fri Jul 24, 2020 1:12 am

Hello,

Thanks for your response.
If you encounter any issues related to our product, just feel free to contact us.
Have a nice day!

Sincerely,
Sofia
E-iceblue support team
User avatar

Sofia.Yang
 
Posts: 84
Joined: Tue Jul 14, 2020 1:41 am

Return to Spire.PDF