views:

42

answers:

1

I am having an issue with displaying a PDF in an iframe in asp.net. When the pdf shows up it is showing up without the Acrobat toolbar that allows the user to zoom and print. This is causing a major hassle for our customers because they cannot read the PDF in the size that it is. If you try and set Acrobat to not show the PDF in the browser and browse to that page you get a message saying that it is trying to open it in Full Screen mode. Any ideas how I can make it not do this from the code? Below is the code I use to stream the PDF to the browser:

Public Shared Sub StreamPdfToBrowser(ByVal doc As Document) Dim Ctx As HttpContext = HttpContext.Current '// Clear any part of this page that might have already been buffered for output. Ctx.Response.Clear() Ctx.Response.ClearHeaders()

'// Tell the browser this is a PDF document so it will use an appropriate viewer.
Ctx.Response.ContentType = doc.DisplayFileType

Ctx.Response.ContentType = "application/pdf"
Ctx.Response.AddHeader("content-type", "application/pdf")

'// IE & Acrobat seam to require "content-disposition" header being in the response. If you don't add it, the doc still works most of the time, but not always.
'// this makes a new window appear: 
Response.AddHeader("content-disposition","attachment[inline]; filename=MyPDF.PDF");
Ctx.Response.AddHeader("Content-Length", doc.DisplayFile.Length)
Ctx.Response.AddHeader("Content-Disposition", "inline; filename=E-Sign Specification Report.pdf")

'// TODO:  Added by KN to possibly fix UA issue
Ctx.Response.ContentType = "application/pdf"
Ctx.Response.AddHeader("content-type", "application/pdf")

'// Write the PDF stream out
Ctx.Response.BinaryWrite(doc.DisplayFile)

'// Send all buffered content to the client
Ctx.Response.End()

End Sub

A: 

Launch the PDF in Adobe Acrobat, go to File, Properties and click on the Initial View tab. Here you can set the default view for when people open this specific PDF, it sounds like "Open in Full Screen mode" is checked.

Chris Haas
I tried setting the PDF option when it is generated to not use full screen mode but it didn't change everything. Is there anyway to force this option from the Response.Write?
bechbd
After creating the PDF, open it in Acrobat. Is the Full Screen option checked?
Chris Haas
I don't have a full version of Acrobat so I can't see. Can you see this somehow in Acrobat Reader?
bechbd