I have this application that get's the PDF text when an user does an upload of some PDF files.
The problem is that my application throw an message error on Event Viewer, and, after that, close yourself.
Can you help me?
Is that an problem with GdPicture?
Look the EventViewer, have some internal methods from GdPicture.
Bellow, you have the code that gets the pdf text:
Code: Select all
public string GetPlainTextFromPDF(byte[] value)
{
statusPlainTextPDF = 2; //sucesso
MemoryStream stream = new MemoryStream(value);
GdPicture12.GdPicturePDF pdf = new GdPicture12.GdPicturePDF();
try
{
pdf.LoadFromStream(stream);
string text = "";
for (int i = 1; i <= pdf.GetPageCount(); i++)
{
pdf.SelectPage(i);
text += pdf.GetPageText() + "\n";
}
pdf.LoadFromStream(null);
return text;
}
catch (Exception e)
{
statusPlainTextPDF = 9; //erro no processamento
logger.LogException(e);
return "";
}
finally
{
stream.Close();
stream.Dispose();
pdf.Dispose();
}
}
And the Event Viewer log:
Nome do Log: Application
Fonte: ASP.NET 4.0.30319.0
Data: 14/03/2016 15:27:55
Identificação do Evento:1325
Categoria da Tarefa:Nenhum
Nível: Erro
Palavras-chave:Clássico
Usuário: N/D
Computador: WB8SSP20A.SISDPVATSIN.CORP
Descrição:
An unhandled exception occurred and the process was terminated.
Application ID: Domain 12
Process ID: 6052
Exception: System.ComponentModel.Win32Exception
Message: The operation completed successfully
StackTrace: at MS.Win32.UnsafeNativeMethods.RegisterClassEx(WNDCLASSEX_D wc_d)
at MS.Win32.HwndWrapper..ctor(Int32 classStyle, Int32 style, Int32 exStyle, Int32 x, Int32 y, Int32 width, Int32 height,
String name, IntPtr parent, HwndWrapperHook[] hooks)
at System.Windows.Threading.Dispatcher..ctor()
at System.Windows.Threading.Dispatcher.get_CurrentDispatcher()
at System.Windows.Media.Imaging.BitmapPalette..ctor(IList`1 colors)
at gdpicture_.gdpicture_ᜀ()
at gdpicture_.ᜀ.gdpicture_ᜀ()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object
state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state,
Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
XML de Evento:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="ASP.NET 4.0.30319.0" />
<EventID Qualifiers="49152">1325</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2016-03-14T18:27:55.000000000Z" />
<EventRecordID>261808</EventRecordID>
<Channel>Application</Channel>
<Computer>WB8SSP20A.SISDPVATSIN.CORP</Computer>
<Security />
</System>
<EventData>
<Data>An unhandled exception occurred and the process was terminated.