Read pdf file has thrown an exception(Exception Type: AggregateException)

Hi Guys,

I’m stuck on reading pdf. I don’t know what to do. I tried what ever I knew. Need yours help. Below are error.

read pdf file has thrown an exception

Source: Read PDF text

Message: One or more errors occurred.

Exception Type: AggregateException

System.AggregateException: One or more errors occurred. —> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
at UiPath.PDF.Pdfium.PdfiumMethods.FPDF_InitLibrary()
at UiPath.PDF.Activities.PDFReader…ctor(String filePath, String password)
at UiPath.PDF.Activities.ReadPDFText.GetFileReader(String fileName, String password)
at UiPath.PDF.Activities.ReadTextFileActivity.<>c__DisplayClass24_0.b__0()
at System.Threading.Tasks.Task1.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task1.get_Result() at UiPath.PDF.Activities.ReadTextFileActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result) at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result) at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager) ---> (Inner Exception #0) System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) at UiPath.PDF.Pdfium.PdfiumMethods.FPDF_InitLibrary() at UiPath.PDF.Activities.PDFReader..ctor(String filePath, String password) at UiPath.PDF.Activities.ReadPDFText.GetFileReader(String fileName, String password) at UiPath.PDF.Activities.ReadTextFileActivity.<>c__DisplayClass24_0.<ExecuteAsync>b__0() at System.Threading.Tasks.Task1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()<—

Thanks & Regards,
Sachchidanand Vishwakarma

@RSVISHWA Reinstall the Package ‘UIPath.PDF.Activities’

Not Worked. Still getting same error.

read pdf file has thrown an exception

Source: Read PDF text

Message: One or more errors occurred.

Exception Type: AggregateException

System.AggregateException: One or more errors occurred. —> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
at UiPath.PDF.Pdfium.PdfiumMethods.FPDF_InitLibrary()
at UiPath.PDF.Activities.PDFReader…ctor(String filePath, String password)
at UiPath.PDF.Activities.ReadPDFText.GetFileReader(String fileName, String password)
at UiPath.PDF.Activities.ReadTextFileActivity.<>c__DisplayClass24_0.b__0()
at System.Threading.Tasks.Task1.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task1.get_Result() at UiPath.PDF.Activities.ReadTextFileActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result) at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result) at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager) ---> (Inner Exception #0) System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) at UiPath.PDF.Pdfium.PdfiumMethods.FPDF_InitLibrary() at UiPath.PDF.Activities.PDFReader..ctor(String filePath, String password) at UiPath.PDF.Activities.ReadPDFText.GetFileReader(String fileName, String password) at UiPath.PDF.Activities.ReadTextFileActivity.<>c__DisplayClass24_0.<ExecuteAsync>b__0() at System.Threading.Tasks.Task1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()<—
Thanks & regards,
Sachchidanand Vishwakarma

I have the exact same error I think…

The output is

18.4.1+Branch.master.Sha.bc66386dd8e2160b6d35f31d5ce934a5aa4cf4bd

Source: Read PDF text

Message: One or more errors occurred.

Exception Type: System.AggregateException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.AggregateException: One or more errors occurred. ----> System.NullReferenceException: Object reference not set to an instance of an object.
at UiPath.PDF.Activities.PDFReader.GetPageText(Int32 pageNo)
at UiPath.PDF.Activities.ReadTextFileActivity.<>c__DisplayClass24_0.b__0()
at System.Threading.Tasks.Task1.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of inner ExceptionDetail stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at UiPath.PDF.Activities.ReadTextFileActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

It is about this PDF.

Hi @RSVISHWA / @trabart,

Please downgrade the version of UiPath.Pdf.Activities Package from 3.0.0 to 1.3.1

Try this, will work for sure.

Thank You

1 Like

Update PDF package to latest version in studio. This worked for me. Production server had latest Uipath version where older pdf package is not compatible