Welcome Guest Search | Active Topics | Sign In | Register

"k4 was unhandled" error Options
Paul F.
Posted: Wednesday, April 17, 2013 3:51:18 PM
Rank: Newbie
Groups: Member

Joined: 4/17/2013
Posts: 3
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.

eo_support
Posted: Wednesday, April 17, 2013 5:21:38 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

If you run the sample HTML directly through our demo application (All Demos -> HTML to PDF -> Basic -> Convert Url), do you get the same error?

Thanks!
Paul F.
Posted: Wednesday, April 17, 2013 5:37:09 PM
Rank: Newbie
Groups: Member

Joined: 4/17/2013
Posts: 3
Yes, running my problem links through the demo application generates the same exception.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.