We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problems with printing and conversion - happens sometimes

Hi,


We just bought license for aspose.pdf product.
we are using it right now for:

1. print pdf files to printers
2. convert tiff files to pdf

in the test everyting worked fine, but in the production this actions not working somtimes. we don’t have a clue why this is hapenning.
we don’t have log for this thing.

what can cause it to fail from time to time.

Hi, I attach the exception type to the mail:


CLR Exception Type - 'System.Runtime.InteropServices.ExternalException’

stack trace:

[29/12/2014 12:23:08] Stack Trace
ChildEBP RetAddr Args to Child
WARNING: Stack unwind information not available. Following frames may be wrong.
0367e730 791aba10 e0434352 00000001 00000005 KERNEL32!RaiseException+0x3c
0367e7c0 791abc49 00e43078 00000000 00000000 clr!StrongNameFreeBuffer+0x3144a
0367e880 7b30bf2a 00000000 00e35de8 00e42ab4 clr!StrongNameFreeBuffer+0x31683
0367e8c4 7917b139 006b1f02 03a7e5b4 e7d10e38 System_Drawing_ni+0x16bf2a
0367e9f8 7917b02d 001b6898 00000000 40829800 clr!StrongNameFreeBuffer+0xb73
0367e9fc 001b6898 00000000 40829800 00000679 clr!StrongNameFreeBuffer+0xa67
0367ea00 00000000 40829800 00000679 7917b150 0x1b6898
OS Thread Id: 0x32cfc (8)
Child SP IP Call Site
0367e838 77e4bef7 [HelperMethodFrame: 0367e838]
0367e888 7b30bf2a System.Drawing.Imaging.Metafile…ctor(System.IO.Stream)
0367e8a0 05a8c93d Aspose.Pdf.XImageCollection.?(System.IO.Stream)
0367e908 05a8c8a0 Aspose.Pdf.XImageCollection.?š(System.IO.Stream, Int32)
0367e918 055273aa Aspose.Pdf.Page.AddImage(System.IO.Stream, Aspose.Pdf.Rectangle, Aspose.Pdf.CompositingParameters, Boolean)
0367e9fc 05526f73 Aspose.Pdf.Image.Process(Double ByRef, Double ByRef, Boolean, Aspose.Pdf.MarginInfo, Double, Double, Aspose.Pdf.Page, System.Collections.Generic.List`1<Aspose.Pdf.Operator>, Boolean, Aspose.Pdf.Paragraphs ByRef)
0367eb04 05525134 ?.Ž.Process()
0367ee84 055243e7 Aspose.Pdf.Page.(Aspose.Pdf.Page)
0367eef8 055241d1 Aspose.Pdf.Page.?Š()
0367ef00 05523c79 Aspose.Pdf.Document.?Š()
0367ef6c 05523935 Aspose.Pdf.Document.Save(System.IO.Stream)

Hi Gabi,


Thanks for contacting support.

Can you please share the resource files causing this problem and also please share some code snippet/sample project so that we can test the scenarios in our environment. We are sorry for your inconvenience.

Continuing to my original question, I attach code snippets as you asked.

The error is in low level, so it is not catched.
EDIT: runs on windows server 2003 as windows service

MemoryStream ms;
try
{
ms = new MemoryStream(buffer);
}
catch (Exception ex)
{

}

PdfViewer viewer = new PdfViewer();

try
{

//Open input PDF file
viewer.BindPdf(ms);
//Print PDF document

// System

var printerSettings = new System.Drawing.Printing.PrinterSettings();

printerSettings.PrinterName = printer;

if (ConfigurationManager.AppSettings[“logPrintMadbekot”] != null)
{
lock (typeof(PrintForms))
{
using (StreamWriter wr = new StreamWriter(@“c:\log.txt”, true))
{
string log = "LoggingEvent: ";
log += "logtime: " + DateTime.Now + ", ";
log += "printer name: " + printer + ", ";
log += "toroid: " + request.MessageParameters.TorOID + ", ";

log += “\r\n”;
wr.Write(log);
}
}
}
// viewer.PrintLargePdf(ms, printerSettings);

// viewer.PrintAsImage = true;
viewer.PrintDocumentWithSettings(printerSettings);


}
catch (Exception ex)
{

}
finally
{

try
{
viewer.Close();
ms.Close();
}
catch (Exception e)
{

}
}

this is the call stack from diagnostic tools

Child SP IP Call Site
04dfde44 77e4bef7 [InlinedCallFrame: 04dfde44]
04dfde40 7b2b1ccf DomainBoundILStubClass.IL_STUB_PInvoke(System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, System.String, IntPtr, System.Runtime.InteropServices.HandleRef, Int32)
04dfde44 7b2dd15d [InlinedCallFrame: 04dfde44] System.Drawing.SafeNativeMethods.DocumentProperties(System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, System.String, IntPtr, System.Runtime.InteropServices.HandleRef, Int32)
04dfdea8 7b2dd15d System.Drawing.Printing.PrinterSettings.GetHdevmodeInternal(System.String)
04dfded4 7b2dd35f System.Drawing.Printing.PrinterSettings.GetHdevmodeInternal()
04dfdee0 7b2db514 System.Drawing.Printing.PrinterSettings.CreateDeviceContext(System.Drawing.Printing.PageSettings)
04dfdf20 7b2ddd3c System.Drawing.Printing.PageSettings.get_HardMarginX()
04dfdf68 028b4b57 Aspose.Pdf.Facades.PdfViewer.?ž(System.Drawing.Printing.PageSettings, Single ByRef, Single ByRef)
04dfdf98 028b490d Aspose.Pdf.Facades.PdfViewer.PrintDocumentWithSettings(System.Drawing.Printing.PageSettings, System.Drawing.Printing.PrinterSettings)
04dfdff4 028b475c Aspose.Pdf.Facades.PdfViewer.PrintDocumentWithSettings(System.Drawing.Printing.PrinterSettings)
04dfe004 04bdd7e3 Mor.GlobalUtils.BL.PrintForms.PrinterPrint(Mor.GlobalUtils.BL.PrintFormsRequest)
04dfe1ac 04bdcc00 Mor.GlobalUtils.WCF.GlobalUtils.PrinterPrint(Mor.GlobalUtils.BL.PrintFormsRequest)
04dfe284 03360be2 DynamicClass.SyncInvokePrinterPrint(System.Object, System.Object[], System.Object[])
04dfe298 51cc2e0f System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(System.Object, System.Object[], System.Object[] ByRef)
04dfe36c 51cc0e07 System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(System.ServiceModel.Dispatcher.MessageRpc ByRef)
04dfe3d8 51cc0b5e System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(System.ServiceModel.Dispatcher.MessageRpc ByRef)
04dfe414 51cc086c System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(System.ServiceModel.Dispatcher.MessageRpc ByRef)
04dfe428 51cc06a9 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(System.ServiceModel.Dispatcher.MessageRpc ByRef)
04dfe450 51cc0609 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(System.ServiceModel.Dispatcher.MessageRpc ByRef)
04dfe464 51cc059b System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(System.ServiceModel.Dispatcher.MessageRpc ByRef)
04dfe474 51cc036e System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(System.ServiceModel.Dispatcher.MessageRpc ByRef)
04dfe484 51cbfa85 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(System.ServiceModel.Dispatcher.MessageRpc ByRef)
04dfe4a4 51cbf954 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(System.ServiceModel.Dispatcher.MessageRpc ByRef)
04dfe4b4 51cbf71f System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean)
04dfe504 51cbf0ab System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(System.ServiceModel.Channels.RequestContext, Boolean, System.ServiceModel.OperationContext)
04dfe6f4 51cbdc67 System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(System.ServiceModel.Channels.RequestContext, System.ServiceModel.OperationContext)
04dfe72c 51cbd913 System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(System.IAsyncResult)
04dfe740 51cbd8c4 System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(System.IAsyncResult)
04dfe750 510439d2 System.Runtime.Fx+AsyncThunk.UnhandledExceptionFrame(System.IAsyncResult)
04dfe778 5104085d System.Runtime.AsyncResult.Complete(Boolean)
04dfe7c8 51041af7 System.Runtime.AsyncResult.Complete(Boolean, System.Exception)
04dfe7d4 51cca1bf System.ServiceModel.Channels.FramingDuplexSessionChannel+TryReceiveAsyncResult.OnReceive(System.IAsyncResult)
04dfe804 510439d2 System.Runtime.Fx+AsyncThunk.UnhandledExceptionFrame(System.IAsyncResult)
04dfe82c 5104085d System.Runtime.AsyncResult.Complete(Boolean)
04dfe87c 51041af7 System.Runtime.AsyncResult.Complete(Boolean, System.Exception)
04dfe888 51cca0b4 System.ServiceModel.Channels.SynchronizedMessageSource+ReceiveAsyncResult.OnReceiveComplete(System.Object)
04dfe8b4 51cc9bdc System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(System.Object)
04dfe8f4 51cb1682 System.ServiceModel.Channels.StreamConnection.OnRead(System.IAsyncResult)
04dfe904 510439d2 System.Runtime.Fx+AsyncThunk.UnhandledExceptionFrame(System.IAsyncResult)
04dfe92c 7a9988dc System.Net.LazyAsyncResult.Complete(IntPtr)
04dfe964 7a99884b System.Net.LazyAsyncResult.ProtectedInvokeCallback(System.Object, IntPtr)
04dfe994 7ae68464 System.Net.Security.NegotiateStream.ProcessFrameBody(Int32, Byte[], Int32, Int32, System.Net.AsyncProtocolRequest)
04dfe9bc 7ae69477 System.Net.Security.NegotiateStream.ReadCallback(System.Net.AsyncProtocolRequest)
04dfe9f0 7a9b326d System.Net.AsyncProtocolRequest.CompleteRequest(Int32)
04dfe9fc 7a9b322c System.Net.FixedSizeReader.CheckCompletionBeforeNextRead(Int32)
04dfea08 7a9b31af System.Net.FixedSizeReader.ReadCallback(System.IAsyncResult)
04dfea34 5104085d System.Runtime.AsyncResult.Complete(Boolean)
04dfea84 51041af7 System.Runtime.AsyncResult.Complete(Boolean, System.Exception)
04dfea90 51cb15c1 System.ServiceModel.Channels.ConnectionStream+ReadAsyncResult.OnAsyncReadComplete(System.Object)
04dfeabc 51ccbb59 System.ServiceModel.Channels.SocketConnection.FinishRead()
04dfeac4 02fa2dd0 System.ServiceModel.Channels.SocketConnection.AsyncReadCallback(Boolean, Int32, Int32)
04dfeb04 02fa2bd8 System.ServiceModel.Channels.OverlappedContext.CompleteCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
04dfeb20 5103f1d9 System.Runtime.Fx+IOCompletionThunk.UnhandledExceptionFrame(UInt32, UInt32, System.Threading.NativeOverlapped*)
04dfeb50 79b15cd4 System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
04dfed38 791421bb [GCFrame: 04dfed38]
04dfee48 791421bb [DebuggerU2MCatchHandlerFrame: 04dfee48]
[30/12/2014 18:07:53] C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\diasymreader.dll loaded at 0x5e0d0000
[30/12/2014 18:07:53] Thread exited. Exiting thread system id - System ID: 20892. Exit code - 0xc0000005
[30/12/2014 18:07:53] Thread exited. Exiting thread system id - System ID: 5836. Exit code - 0xc0000005
[30/12/2014 18:07:53] Thread exited. Exiting thread system id - System ID: 25888. Exit code - 0xc0000005
[30/12/2014 18:07:53] Thread exited. Exiting thread system id - System ID: 5620. Exit code - 0xc0000005
[30/12/2014 18:07:53] Thread exited. Exiting thread system id - System ID: 16156. Exit code - 0xc0000005
[30/12/2014 18:07:53] Thread exited. Exiting thread system id - System ID: 21408. Exit code - 0xc0000005
[30/12/2014 18:07:53] Thread exited. Exiting thread system id - System ID: 9332. Exit code - 0xc0000005
[30/12/2014 18:07:53] Thread exited. Exiting thread system id - System ID: 13484. Exit code - 0xc0000005
[30/12/2014 18:07:53] Thread exited. Exiting thread system id - System ID: 20012. Exit code - 0xc0000005
[30/12/2014 18:07:53] Thread exited. Exiting thread system id - System ID: 25896. Exit code - 0xc0000005
[30/12/2014 18:07:53] Thread exited. Exiting thread system id - System ID: 6092. Exit code - 0xc0000005
[30/12/2014 18:07:53] Thread exited. Exiting thread system id - System ID: 22644. Exit code - 0xc0000005
[30/12/2014 18:07:53] Process exited. Exit code - 0xc0000005

Hi, I see that my call is still unanswered. Is there a reason why? I think that we are doing very simple stuff…


Hi Gabi,


Thanks for sharing the details and sorry for the delayed response.

I have tested the scenario while printing one of my sample PDF files using the code snippet which you have shared and I am unable to replicate the issue. The PDF file is properly being printer using Microsoft XPS Document Writer installed over my machine. Can you please confirm that the problem is appearing for any particular file or its appearing for all the documents ?

Also please share a sample project which can help us in replicating this issue in our environment. We are really sorry for this inconvenience.