PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Generated PDF not showing in IE but showing in Firefox

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
brogge



Joined: 29 Nov 2006
Posts: 2

PostPosted: Wed Nov 29, 2006 10:45 am    Post subject: Generated PDF not showing in IE but showing in Firefox Reply with quote

Hello PDFSharp experts,

I recently started experimenting with the PDFSharp library and so far everything went well.

I now create a PDF on the fly and am trying to serve this through my webserver (IIS 6.0) to the client. In Firefox this is working fine. For some reason I'm not seeing anything in Internet Explorer. IE just shows a blank page.

This is the code that I've created (which is almost exactly the same as the web example).

// Send PDF to browser
MemoryStream stream = new MemoryStream();
document.Save(stream, false);

// document.Save(@"c:\inetpub\winscout\content\test.pdf");
Response.Clear();
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Length", stream.Length.ToString());
Response.BinaryWrite(stream.ToArray());
Response.Flush();
Response.End();

stream.Close();

When I save the file to disk it can be opened in a PDF-viewer. So the file itself looks OK.

Any suggestions on why IE refuses to show the file ?

Thanks in advance,

boris
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Wed Nov 29, 2006 10:59 am    Post subject: Reply with quote

Does IE display other PDF files?
On my computer IE has a problem displaying PDF files - probably because I installed 2 versions of Adobe Acrobat.

IE displays PDF files if I manually launch Acrobat Reader 7 before clicking the link in IE.
I get a blank page if I click a link in IE w/o an open Acrobat Reader.
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
brogge



Joined: 29 Nov 2006
Posts: 2

PostPosted: Wed Nov 29, 2006 11:04 am    Post subject: Reply with quote

Hi Thomas,

IE displays PDF files when I click for example a link in a web page. That is why I was guessing that I did something wrong with http-headers (but then again: Firefox seems to work fine).

Whether Adobe Acrobat Reader is started or not doesn't seem to make a difference. As far as I know I have only one version of acrobat installed. I'm running IE 7.



boris
Back to top
View user's profile Send private message
natethornton



Joined: 20 Dec 2006
Posts: 3

PostPosted: Thu Dec 21, 2006 5:20 pm    Post subject: You need the following to work in both IE and Firefox Reply with quote

Here is the code you need to make it work in both IE and Firefox, and open inside the browser window:


MemoryStream stream = new MemoryStream();
document.Save(stream, false);

Response.Clear();
Response.ContentType = "application/pdf";
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();
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com