Once I got ABCpdf 8 running when invoked from a Windows service, it worked for a long time without any problems:
I split the document, which can become quite large, into its chapters, have each chapter generate the HTML, pass the HTML to ABCpdf, and finally merge the parts using iTextSharp, along with page numbering and header and footer generation.
Until, one day, two chapters consistently raised the exception
System.Exception: Remote process terminated unexpectedly. —> System.Runtime.Serialization.SerializationException:
End of Stream encountered before parsing was completed.
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream,
HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at WebSupergoo.ABCpdf8.Internal.Spawntaneous.RpcCaller.Call(MethodBase method, Object[] parameters)
— End of inner exception stack trace —
Server stack trace:
at WebSupergoo.ABCpdf8.Internal.Spawntaneous.RpcCaller.Call(MethodBase method, Object[] parameters)
at WebSupergoo.ABCpdf8.Internal.Spawntaneous.RemoteInstance`1.Invoke(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at WebSupergoo.ABCpdf8.Internal.Gecko.IGeckoWorker.AddImageUrl(String url, Double pageWidthMm, Double pageHeightMm, Byte[] serializedOpts)
at WebSupergoo.ABCpdf8.Internal.Gecko.GeckoCallback.MyCallback(IntPtr closure, IntPtr serializedOpts, UInt32 serializedOptsLen, Double widthInMm, Double heightInMm, String url, UInt32& outNumCommands, IntPtr& outSerializedData, UInt32& outSerializedDataLen)
at WebSupergoo.ABCpdf8.Internal.NDoc.N.AddImageUrlGecko_32(IntPtr doc, String url, Int32 width, IntPtr callback, String& outErr)
at WebSupergoo.ABCpdf8.Internal.Gecko.DocAddGecko.AddUrl(Doc doc, String url, Boolean paged, Int32 width, String& err)
at WebSupergoo.ABCpdf8.Internal.Gecko.DocAddGecko.AddHtml(Doc doc, String html, Boolean paged, Int32 width, String& err)
at WebSupergoo.ABCpdf8.Doc.AddImageHtml(String html, Boolean paged, Int32 width, Boolean disableCache)
at WebSupergoo.ABCpdf8.Doc.AddImageHtml(String html)
Teh internets were of no use, unfortunately, and there was no trace of what had happened in the Event Log, so I poked around a bit, and tried to find the intermediate documents or log files hopefully generated by ABCpdf.
I did not find a clue of what exactly had caused the exception, but after deleting the directory
C:\Users\[service account]\AppData\Local\Temp\ABCpdf
PDF generation worked fine again.