PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

Sending Document object to IE
http://forum.pdfsharp.com/viewtopic.php?f=2&t=221
Page 1 of 1

Author:  Sawan [ Wed Sep 12, 2007 6:10 am ]
Post subject:  Sending Document object to IE

Hi,

I'm using PDFSharp for filling the PDF forms.

My Query is:
I have assigned some value to any field of the acro form and now I want to pass the document object to IE to show the same pdf object using response.

So, how can I send the document object to IE to open it as PDF?
How can I convert the document object to Byte[] stream?

Thanks in Advance.

Regards,
Sawan

Author:  Thomas Hoevel [ Wed Sep 12, 2007 8:02 am ]
Post subject: 

Hi!
Please check the Clock sample in the PDFsharp\WebSamples folder.

Author:  Sawan [ Wed Sep 12, 2007 10:24 am ]
Post subject:  One more Help needed

Hi Thomas,

Thanks for replying.

It works for me now. But the problem is, its opening the PDF in Mozilla but not in IE.

Also if i'm trying to come out from one more problem.

When I use the use PdfDocumentOpenMode.Modify its not showing the value of forms fields in pdf. but it shows only when use as PdfDocumentOpenMode.ReadOnly.

And ReadOnly throws an error when I tries to save the document object to stream.

Thanks in Advance again.

Regards,
Sawan

Author:  Thomas Hoevel [ Wed Sep 12, 2007 11:44 am ]
Post subject: 

It seems there is a solution for the IE problem:
Click here

Author:  Sawan [ Wed Sep 12, 2007 12:30 pm ]
Post subject:  IE Problem...

Hi Thomas,

I have written the same line of except some datatype conversion code but it still having the same problem and I'm using Acrobat Professional6.0.

Your Suggestion:
Response.AddHeader("Accept-Header", stream.Length);
Response.AddHeader("Content-Length", stream.Length);
Response.OutputStream.Write(stream.GetBuffer(), 0, stream.Length);
Response.Flush();
Response.End();
stream.Close();


My Code:
Response.ContentType = "application/pdf";
Response.AddHeader("Accept-Header", stream.Length.ToString()); --- converting int to string
Response.AddHeader("content-length", stream.Length.ToString()); --- converting int to string
int i = (int)stream.Length; --- Converting long to int
Response.OutputStream.Write(stream.GetBuffer(), 0, i);

Regards,
Sawan

Author:  Thomas Hoevel [ Wed Sep 12, 2007 2:03 pm ]
Post subject: 

Our code in the WebClock sample:
Code:
  // Send PDF to browser
  MemoryStream stream = new MemoryStream();
  document.Save(stream, false);
  Response.Clear();
  Response.ContentType = "application/pdf";
  Response.AddHeader("content-length", stream.Length.ToString());
  Response.BinaryWrite(stream.ToArray());
  Response.Flush();
  stream.Close();
  Response.End();

This code works with IE (at least on our computers).

I referred you to the topic on this forum because some people complained that this code was not working. (I admit I didn't test the solution suggested in that thread.)

Author:  Sawan [ Wed Sep 12, 2007 3:50 pm ]
Post subject: 

Hi Thomas,

Thank you for replying. But again the code is not working for me.

I'm also stucked at one more problem(which I posted in my last reply) and hope some positive reply from you.

Problem:
Also if i'm trying to come out from one more problem.

When I use the use PdfDocumentOpenMode.Modify its not showing the value of forms fields in pdf. but it shows only when use as PdfDocumentOpenMode.ReadOnly.

And ReadOnly throws an error when I tries to save the document object to stream.


Again Thanks in Advance.

Regards,
Sawan

Author:  Sawan [ Wed Sep 12, 2007 4:02 pm ]
Post subject:  Message from IE

Hi Thomas,

I just did right click on IE where the PDF is not shown. its showing the following message. "The XML source file is unavailable for Viewing."

Hope this can help.

Regards,
Sawan

Author:  Sawan [ Fri Sep 14, 2007 9:57 am ]
Post subject:  any Update

Hi Thomas,

Can you please provide any solution for this problem?

Regards,
Sawan

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/