Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Error Locating Object Handler When Downloading a .pdf File


Message #1 by "Ravikumar Gurrapu" <mail2grk@y...> on Wed, 24 Jul 2002 16:51:39
Hi 

1.
<%
   ' create PDF
   ' ..........
   ' returns pObjResult object. This is result PDF object
    
   Response.Buffer = true
   Response.ContentType = "application/pdf"
   Response.Addheader "Content-Disposition", "inline; 
filename=DownloadPDF.pdf"

   call Response.BinaryWrite(pObjResult.get_buffer())
   Response.End
%>

  I was trying to create a pdf dynamically using PDFLib and send it to 
client side using ASP. Using above code I was getting 'Error locating 
Object Handler' in IE 5.0. 
  I made the following change then it worked.


<%
   ' create PDF
   ' ..........
   ' returns pObjResult object. This is result PDF object

   dim BrowserVersion
   BrowserVersion =  Request.ServerVariables("HTTP_USER_AGENT")    

   Response.Buffer = true
   Response.ContentType = "application/pdf"
   If(Instr(1, BrowserVersion, "MSIE 5", 1) <> 0) Then 
        Response.Addheader "Content-Disposition", "inline; 
filename='DownloadPDF.pdf'"
  else
	Response.Addheader "Content-Disposition", "inline; 
filename=DownloadPDF.pdf"
  end if

  call Response.BinaryWrite(pObjResult.get_buffer())
  Response.End
%>

2. You can solve the above problem by unchecking 'Display PDF in Browser' 
propety of Adobe 5.0. You can find this property in Edit > Prefereces > 
Options.
   In Adobe 4.0 File > Prefereces > General.
   If you going with this solution then no need to change your asp code. 
Old code will work with this change.
 
Thanks
Ravi

  Return to Index