Welcome Guest Search | Active Topics | Sign In | Register

Occasional "Handle is invalid" errors from EO.pdf Options
Matt
Posted: Friday, February 27, 2015 2:27:31 PM
Rank: Newbie
Groups: Member

Joined: 2/27/2015
Posts: 7
Support,

Occasionally we get the following errors when generating web pages using EO.pdf:

System.IO.IOException: The handle is invalid.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count) at EO.Pdf.Internal.b4.a(Stream A_0)
at EO.Pdf.Internal.hh.a(Stream A_0)
at EO.Pdf.Internal.hh.b(String A_0)
at ARRT.Utilities.PDFutil.GenerateConfPagePDF(String html, String filename, Boolean resize, Boolean removeImages)
at Renewal_Confirmation.Page_Load(Object sender, EventArgs e)

Could you tell us how to stop these errors from occurring?

Using EO.PDF version 4.0.41.2

Thanks!
eo_support
Posted: Friday, February 27, 2015 2:34:41 PM
Rank: Administration
Groups: Administration

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

This can happen if you pass a Stream object to our converter and the Stream object has been closed/disposed before EO.Pdf has finished writing to the stream.

Thanks!
Matt
Posted: Friday, February 27, 2015 4:08:09 PM
Rank: Newbie
Groups: Member

Joined: 2/27/2015
Posts: 7
Thanks, one last question.

If it's because the stream object has been closed, why would that be?

Is the scenario when someone lets the page partially load and they close out their browser?

We are not ending the stream, so what causes the stream to close or dispose before it's done?
eo_support
Posted: Friday, February 27, 2015 4:57:47 PM
Rank: Administration
Groups: Administration

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

It would depends on what kind of Stream object. Do you see anything in between:

EO.Pdf.Internal.hh.b(String A_0)

And

ARRT.Utilities.PDFutil.GenerateConfPagePDF(String html, String filename, Boolean resize, Boolean removeImages)

In your stack trace?

It is not possible for your GenerateConfPagePDF to call EO.Pdf.Internal.hh.b directly.

Thanks!
Matt
Posted: Friday, February 27, 2015 5:17:59 PM
Rank: Newbie
Groups: Member

Joined: 2/27/2015
Posts: 7
Here is the code.

We don't specifically have any stream objects. Just an HTML string we pass to this:

HtmlToPdfOptions options = new HtmlToPdfOptions();
if (resize)
options.ZoomLevel = 0.8f;
options.NoLink = true;
options.NoScript = true;
options.NoCache = true;
options.PageSize = PdfPageSizes.A4;
PdfDocument doc = new PdfDocument();
doc.EmbedFont = false;
HtmlToPdf.ConvertHtml(html, doc, options);

It looks like the last line HtmlToPdf.ConvertHtml(html,doc,options) is actually what calls: EO.Pdf.Internal.hh.b(String A_0)
eo_support
Posted: Saturday, February 28, 2015 9:31:10 AM
Rank: Administration
Groups: Administration

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

Can you still provide the full stack trace?

Thanks!
Matt
Posted: Monday, March 2, 2015 10:31:27 PM
Rank: Newbie
Groups: Member

Joined: 2/27/2015
Posts: 7
It is in the first post of this message, or where you looking for something else?

The ARRT.Utilities.PDFutil.GenerateConfPagePDF code contains the code I posted on Feb 27 @ 4:17PM:

HtmlToPdfOptions options = new HtmlToPdfOptions();
if (resize)
options.ZoomLevel = 0.8f;
.....
.....

Let me know what else you need.
eo_support
Posted: Tuesday, March 3, 2015 12:29:34 PM
Rank: Administration
Groups: Administration

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

Something is missing in between:

EO.Pdf.Internal.hh.b(String A_0)

And

at ARRT.Utilities.PDFutil.GenerateConfPagePDF

Because it is not possible for your GenerateConfPagePDF to call our Internal.hh.b directly. The stack trace should the ConvertHtml call. That's why we were asking for the full stack trace. Can you check why it's missing?

Thanks!


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.