PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Mar 29, 2024 4:53 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Wed Sep 12, 2007 6:10 am 
Offline

Joined: Wed Sep 12, 2007 6:01 am
Posts: 7
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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Sep 12, 2007 8:02 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Hi!
Please check the Clock sample in the PDFsharp\WebSamples folder.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: One more Help needed
PostPosted: Wed Sep 12, 2007 10:24 am 
Offline

Joined: Wed Sep 12, 2007 6:01 am
Posts: 7
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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Sep 12, 2007 11:44 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
It seems there is a solution for the IE problem:
Click here

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: IE Problem...
PostPosted: Wed Sep 12, 2007 12:30 pm 
Offline

Joined: Wed Sep 12, 2007 6:01 am
Posts: 7
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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Sep 12, 2007 2:03 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
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.)

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Sep 12, 2007 3:50 pm 
Offline

Joined: Wed Sep 12, 2007 6:01 am
Posts: 7
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


Top
 Profile  
Reply with quote  
 Post subject: Message from IE
PostPosted: Wed Sep 12, 2007 4:02 pm 
Offline

Joined: Wed Sep 12, 2007 6:01 am
Posts: 7
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


Top
 Profile  
Reply with quote  
 Post subject: any Update
PostPosted: Fri Sep 14, 2007 9:57 am 
Offline

Joined: Wed Sep 12, 2007 6:01 am
Posts: 7
Hi Thomas,

Can you please provide any solution for this problem?

Regards,
Sawan


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 150 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group