Make PDF display inline instead of separate PDF Reader window

I’ve got an ASP.NET ashx class that obtains data from a database, creates a PDF file utilizing iTextSharp, and streams the PDF to the web browser. The browser (IE and Firefox at least) is releasing Acrobat Reader as a separate window to open the file. I ‘d like for it to show inline within the internet browser. C# guide for setting pdf document showing in pdf reader http://www.iditect.com/tutorial/pdf-document/

Is that something I can entirely manage from the server side? I’m currently setting the Content-Type header to application/pdf, and I’ve attempted setting Content-Disposition and Content-Length. Nothing up until now has worked.

Is there another header I’m missing? Exists something in the PDF itself that tells the web browser the best ways to display it? Any other ideas?

Setting the content-disposition and content-type headers ought to do it, but you might also require to call Response.ClearHeaders() to clear other headers that have been set.

Attempt utilizing Fiddler to see the real headers and material from the reaction and compare them to those from a website that works like you want.

OK, finishes up it was actually a crazy inquiry, however I am actually happy I asked it since I had really certainly never come to be informed of Fiddler (which led me to the response, which is why I am actually allowing tspauld’s reaction). The PDF is made by an internet service that offers the report to a couple of various front-end web sites. I was preparing the content individual to inline in the company, but that didn’t concern, due to the truth that the web internet browser never got that header; it acquired the header from the front-end web site (which was accessory). I changed it in the front-end site which fixed it.

Assess your mounted variation of Adobe Artist. There is an environment in choices for “Internet” and a checkbox that claims “Feature PDF in Web Browser”.

it would possess functioned for you considering that of your client edge settings for Adobe or whatever PDF reader you are using. If you have a various model, or even possess show in internet browser handicapped, it will certainly not operate.

If you need to flow the feedback with an ashx somewhat of having the ability to return an aspx, I believe you might run out good luck.

So the solution is actually that you require to have Content-Type= application/pdf and also Content-Disposition= inline; filename= Something.pdf, as others have in fact claimed.

I have actually prepared my Artist Visitor to present inline nevertheless that does not appear to create a difference. I have really been to other PDF pages that display inline in my world wide web browser, however the one I’m offering does not.

Or else, I assume the settings to display in world wide web browser or even certainly not, is entirely client steered and also away from your hands.

It is actually helping me on IIS6, IE7, ASP.NET3.5. Have you tried the quite little instance in a number of web browsers? If thus I’ll feature my complete resource to the action.

Anyhow If my article does certainly not appear crystal clear to you, have an appearance at this example The greatest techniques to Show PDF files along with ASP.NET

If you have the spending plan, my business offers a set of products that consists of an AJAX based image viewer that will let you see the PDF pages in line without Acrobat at all. In its easiest type, it is simply a viewer, however you can layer in interactivity as you need.

Leave a Reply

Your email address will not be published. Required fields are marked *