I'm attempting to convert some local HTML files to PDFs and am getting this error:
Quote:This session is no longer valid. If you wish to reuse the session later, please consider calling GetCookies to retain the session cookies, then reuse these cookies through HtmlToPdfOptions.Cookies with another session. (5)
The data is from a corporate wiki downloaded to my local drive. The HTML links were adjusted by the capture software to point to the downloaded data. I wrote an application several months ago that crawled through an earlier version of this data and converted all HTML to PDF without this error. I updated to the latest EO.PDF.dll (4.0.60.2) but the issue persists. I wrote a short piece of sample code to replicate this problem:
Quote:
string sourceFile = @"C:\Local Website Capture\wiki\test\index.html";
string targetFile = @"C:\EO PDF\test.pdf";
EO.Pdf.Runtime.AddLicense("xxx")
HtmlToPdfOptions optionsPackage = new HtmlToPdfOptions();
optionsPackage.NoScript = true;
optionsPackage.PageSize = new SizeF(8.5f, 11f);
optionsPackage.OutputArea = new RectangleF(0.25f, 0.25f, 8.0f, 10.5f);
optionsPackage.AllowLocalAccess = true;
EO.Pdf.HtmlToPdf.ConvertUrl(sourceFile, targetFile, optionsPackage);
I do not get the error if I point my source to a live link, nor do I get it if I go to a live site, save it locally via the browser, then use the local HTML page as my input doc. Also, I can open the problematic HTML pages in a browser and they display fine.
Here is the stack track for the error:
Quote:
at EO.Pdf.Internal.lr.l()
at EO.Pdf.Internal.lr.a(a A_0)
at EO.Pdf.Internal.lr.a(cl A_0)
at EO.Pdf.HtmlToPdfSession.Dispose()
at EO.Pdf.HtmlToPdf.ConvertUrl(String url, PdfDocument doc, HtmlToPdfOptions options)
at EO.Pdf.HtmlToPdf.ConvertUrl(String url, String pdfFileName, HtmlToPdfOptions options)
at EOPdfConverterTest.Program.Main(String[] args) in C:\Users\xx\Program.cs:line 35
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
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()
My app and this sample code were both written in C# in Visual Studio 2010. Since authoring the software, I have applied all the usual Windows 7 (x64) updates, upgraded IE9 to IE10, and installed Visual Studio 2012. I tried running the code in a virtual XP machine and got the same results.
Let me know if you have any suggestions. Thank you in advance.
--Paul F.