Cannot open pdf from a link in web page

Hi,
I have a link in a web page that gets a Blob(pdf file) from Oracle database and returns the pd file.
The code in my jsp is :
// I got this from an Action (I�m using Struts)
java.sql.Blob file=(java.sql.Blob)request.getAttribute("PDFfile");
String filename=(String)request.getAttribute("filename");
try{
  int iLength = (int)(file.length());
  response.setHeader("Cache-Control","no-cache");
  response.setHeader("Content-Disposition", "attachment; filename=\""+filename+"\"");
  response.setContentType("application/pdf");
  response.setContentLength(iLength);
  ServletOutputStream os = response.getOutputStream();
  InputStream in = null;
  in = file.getBinaryStream();
  byte buff[] = new byte[1024];
  while (true) {
     int i = in.read(buff);
     if (i<0) break;
       os.write(buff,0,i);
  os.flush();
  os.close();
} catch(Exception ex){
  out.println("Error while reading file : " + ex.getMessage());
}When I click the link, a popup windows asks if I want to save the file or open it. If I save it, there is no problem, I can open the file and see the content but if I try to open the content, I get an error in Acrobat Reader ("error opening the document.File not found"). Does I need to have a "physical file" to be able to open it ?
Another question : What I have to do to open the pdf file in the browser and not in the acrobat reader ? I have IE 6.0 and acrobat reader 6.0. Doeas I need to put some pluggin in IE ?
Thanks !

// I got this from an Action (I�m using Struts)
java.sql.Blob file=(java.sql.Blob)request.getAttribute("PDFfile");
String filename=(String)request.getAttribute("filename");
try{
  int iLength = (int)(file.length());
  response.setHeader("Content-type", "application/pdf");   
  response.setHeader("Content-Disposition", "inline; filename=\""+filename+"\"");
  response.setHeader("Expires","0");
  response.setHeader("Cache-Control","must-revalidate, post-check=0, pre-check=0");
  response.setHeader("Pragma","public");
  response.setContentLength(iLength);
  ServletOutputStream os = response.getOutputStream();
  InputStream in = null;
  in = file.getBinaryStream();
  byte buff[] = new byte[1024];
  while (true) {
      int i = in.read(buff);
      if (i<0) break;      
      os.write(buff,0,i); 
  os.flush();
  os.close();
} catch(Exception ex){
   out.println("Error while reading file : " + ex.getMessage());
}and now it�s running !!! I�m not using response.setContentType(...) and I do this in response.setHeader("Content-type", "application/pdf"). And I use response.setHeader("Content-Disposition", "inline; filename=\""+filename+"\"") instead of response.setHeader("Content-Disposition", "attachment; filename=\""+filename+"\"");

Similar Messages

  • Cannot Open pdf from a link inside a web page.

    I cannot open a pdf that is in link in a web page.  I get an error message saying "cannot find file ... Make sure that path or Internet address is correct"it is looking for the PDF on our network and also when I open the Web page from a flash drive on the same computer where the web page and PDF are in the same folder, it asks if I trust the site and I choose Allow and the PDF does not open then either. But when i do the latter on a different machine, open the folder and web page from a FD where they are in the same folder, it asks if I trust the site and I choose Allow, it opens the PDF.
    Adobe Acrobat 8 Standard 8.1.3
    Internet Explorer 8.0.6001.18702
    Windows XP Professional  Version 2002 Service Pack 3
    Any ideas as to what is going on here?

    Here is the markup in the web page for the link to the PDF:
    "<a
     href="MANUAL/station%20manual.pdf">Fuel Station Manual</a>"

  • Cannot open PDFs from a link in another PDF

    Hello, I am having a strange issue on some of my users' adobe readers. (2 users on windows 8.1 PCs)
    I have created an "app choser" (see below image) which is basically an "easy one page choser" for the different "fillable forms" I have created which has been working perfectly up until this week. Basically there is 12 buttons and when the user presses one of these buttons,  the chosen fillable form / app opens which they can then fill in and send on as required.
    However the 2 users that are having problems, cannot open the forms at all. They click on the button but nothing at all is happening. Adobe reader is just not registering that there are links at all.
    The "app choser" works on all my users PC's except 2, so I know its not a location error or to do with updates etc.. Does anyone have any clues or ideas.
    I have already tried going into preferences - trust manager - internet access from PDF - change settings - Allow PDF files to access websites...... but this made no difference at all.
    thanks
    Sara

    doesnt matter i've fixed it. if anyone else is having the same issue then I fixed it by doing the below:
    Edit - preferences- Security enhanced -
    unclick "enable protected mode at startup" - restart adobe reader
    bizarrely i've not had to unclick this on any of my other users PC's (on both windows 7 & 8.1), but was necessary for some reason on the ones having trouble with opening PDF links from the "app chooser PDF".

  • I cannot open pdfs from my email

    I cannot open pdfs from my email

    Do you really expect that someone will be able to help you with the amount of information you provide...?
    What is your operating system?
    What is your email client?
    What is your Reader version?
    What exactly means "cannot"?

  • Installed Pro 9 and Reader 9 now cannot open pdf from web, but can from an email?

    Installed Both Adobe Acrobat 9 professional and reader 9 yesterday on co worker machine. Went to open a pdf attachement in email no problem. Went to web to download and open a pdf and will not let her, giving co worker the error message need reader 8 or 9 to open this document!
    have unistalled 9 reader and reinstalled same problem.
    So then uninstalled reader 9 and can now open pdf from the web
    My machine has both on and no problems.
    Thank YOU for your help!!

    It may be that you will need to uninstall Reader and Repair Acrobat after the uninstall. Adobe does not recommend the installation of both products. Since you have already done the uninstall and things work fine with just Acrobat, leave things alone as that is the recommended installation.

  • Acrobat reader XI cannot open pdfs from IE9

    My pc has IE9, windows 7.  After I installed Acrobat reader XI, I can no longer open pdfs from a secure website.  Can anyone help?

    "Internal Error Occurred" appears when .pdf is opened from Outlook 2010 email
    I am absolutely pulling out my hair over this one!!
    PC/Win 7 64bit/Adobe XI/Office 2010
    I have tried Uninstalling and re-installing
    I have tried using an adobe software removal tool
    I have tried modifying the security settings in reader
    I've tried running repair on MS Office
    If you open the .pdf from an email directly, it opens Reader with the error "Internal Error Occurred"
    If you drag and drop the .pdf onto the desktop, and then open it, it opens.
    If you open Adobe Reader FIRST, then open the .pdf from the email, it opens fine.
    ONLY when you open a .pdf from an email with Adobe Reader closed (so Outlook is asking AR to open first, and then present the .pdf) is it behaving this way.
    Hypothesis: Outlook 2010 does not like to open Adobe Reader.
    SO....tell me all of you brilliant geniuses? How do I solve this puzzle and become an end user's hero?

  • Reader XI - Cannot open PDFs from Outlook:  Internal error occured.  Access is denied.

    I have a user that when they try to open a PDF from Outlook they get two errors. An internal error occured, and Access is denied.  I HAVE tried everyone's solution of unchecking 'Enabled Protected Mode' in Adobe > Edit > Preferences...but, this has NOT worked. The user is currently running Windows XP and has Outlook 2010.  The attachments DO open if you save them to computer first, or if Adobe Reader is already open.  Please help.  Thank you.

    "Internal Error Occurred" appears when .pdf is opened from Outlook 2010 email
    I am absolutely pulling out my hair over this one!!
    PC/Win 7 64bit/Adobe XI/Office 2010
    I have tried Uninstalling and re-installing
    I have tried using an adobe software removal tool
    I have tried modifying the security settings in reader
    I've tried running repair on MS Office
    If you open the .pdf from an email directly, it opens Reader with the error "Internal Error Occurred"
    If you drag and drop the .pdf onto the desktop, and then open it, it opens.
    If you open Adobe Reader FIRST, then open the .pdf from the email, it opens fine.
    ONLY when you open a .pdf from an email with Adobe Reader closed (so Outlook is asking AR to open first, and then present the .pdf) is it behaving this way.
    Hypothesis: Outlook 2010 does not like to open Adobe Reader.
    SO....tell me all of you brilliant geniuses? How do I solve this puzzle and become an end user's hero?

  • Cannot open pdf from Gmail in Adobe Reader app on iphone4s

    All
    I have installed Gmail and Adobe Reader App on my iphone4s with ios 6.0.1...I was trying to open a PDF attachement from Gmail in Adobe Reader to sign it electronically, however the attachement just does not show the "open in" option
    I tried tapping and holding the attachment icon, it just shows "Open / Bookmark/ Copy"...
    Also i tried opening the attachement first and then tapping on it, it just shows "open in Safari"
    Is there any settings to be done to add the options of Opening in Adobe Reader/or any other Docu Sign app
    Appreciate if someone could help
    Sandip

    I tried tapping and holding the attachment icon, it just shows "Open / Bookmark/ Copy"...
    Also i tried opening the attachement first and then tapping on it, it just shows "open in Safari"
    Is there any settings to be done to add the options of Opening in Adobe Reader/or any other Docu Sign app . the exhibition booth systems one would work i think
    Appreciate if someone could help

  • Cannot open pdf with IE/ windows 7.

    Dear friends, and those who understand better than I.  I have been working on this situation for over a week.  I cannot open pdf from the browser.  I tried the "patch " as discussed in a different forum, but still only get the link to open in a seperate white blank page.  Any ideas?  I dont mind going back to an older version other than 10.1.2. I just dont know how to do that either, as I have not had to work this in depth with any software for years.

    Thanks for responding to this matter.  When I double click the link to open the pdf... a new tab opens with a blank screen.  It is white.  When I try to refresh, nothing happens.  I have also tried to save/download the file, and open it through that way.  When asked to save the document "pdf" is not available.  Only "all files."  However when I try to retrieve it, it says download is not available, as in... it did not download or save. 
    1.  All web browser options are selected.  I have already tried to uncheck, one, and all of these boxes.  Still the same results. 
    2.  I have tried several URL... All of the documents I have tried to retrieve have been within a secured website, such as salliemae.com (trying to view a 1098 for my student loan), and mycheckfree.com (trying to view bills from ComED and Nicor Gas). 
    If I open an old pdf on my computer... I can still read that.   
    Thank you for your time and help.  Im so frustrated, and missing deadlines!

  • Cannot send email when clicking lonk on web page

    I cannot send email when clicking link on web page. 
    When I would click the link to send via email I was being directed to hotmail to open new account.
    Today the tech tried to assist me and completely messed up my email capabilities by setting up
    windows live account.
    I am thoroughly disgusted with FIOS internet services..Every time I've called them in the past month problem has been with someone else whose portal services they are using.
    I cannot send emails because all my contact information cannot be moved.
    I'm paying for FIOS internet service that is almost non existent.
    THe VZ in home agent doesn't work nor does the FIOS information site.
    My next move is to get rid of FIOS.
    They create more problems then they solve with me.

    If I understand your problem correctly, you are having trouble when clicking on a MailTo link on any webpage? What loads when you click this type of link is a setting in your browser. If you tell us what browser you are using, we can try to direct you to the setting.
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.
    "All knowledge is worth having."

  • Cannot open pdf files from the web

    I have downloaded Adobe REader 10.0.1 twice and restarted my Mac.  Operating syste, Mac OS X 10.6.6.  I cannot open files from the web, but there is no problem with opening previously save files.  Thanks for any suggestions.

    un-installed old version and installed new version of READER and all functions have returned

  • Cannot open pdf files on my web site

    i cannot open pdf files i uploaded to my web site. error message indicated i need to upgrade adobe reader. did that, still doesn't work.

    What is the exact wording of the error? Apparently you got the PDFs from someplace else since you are using Reader. The major issue when uploading PDFs to a web site is to be sure you used a binary upload. PDF files are binary files and not ASCII files. I suspect that is the issue.

  • Cant open pdf from links?

    When on the web if I click on a link to a pdf all I get is a 'page cant open' error.  I can left click and save the target to my desktop then open it.
    I have the same issue locally, I have several pdf's in a single folder, I created an excelsheet in the same folder and then created a link from the excel to a pdf.
    The link did not work, just a screen flash and nothing happened.
    Using windows7, Acrobat7and latest Norton.
    I am sure I jsut need to adjust a setting somewhere, perhaps in Adobe or Norton.
    By simply double click on a pdf it opens with no issues, it is just just trying tp open a pdf from a link that does not work.
    Any advise?

    Which browser?
    I sometimes get this.
    Check to make sure that the server you are downloading pdf from is serving it as an application/pdf. Otherwise it may be corrupt.
    Try in a different browser, if it doesn't work, best bet is that it is to do with a plugin issue. You may need to restart.
    Cr8tiveness
    IT Support Specialist
    Onevali Pty. Ltd. - 03 9015 0409 http://www.onevali.com.au

  • I cannot open pdf files from one supplier when using Adobe Reader but I can using another Viewer

    I cannot open pdf files from one supplier when using Adobe Reader but I can open it if using Google PDF viewer or another viewer. The Adobe reader gives the error "There was an error opening this document. The file is damaged and could not be repaired" when I try to open the file. The version of Adobe Reader is 10.1.7, however I have tried other versions and they all fail the same way.  I have tested on a number of different PC's in different networks and all fail using Adobe Reader but work using alternate viewer. Also the PC's will open a PDF from any other source.

    Newer Reader versions are more strict than older versions (and other PDF viewers).  If certain minimum requirements are not met, Reader will tell you that the PDF is damaged.  This can happen when a document was created with software that does not adhere to PDF standards, or when the file was damaged during a download or email transmission.
    You should contact the creator of these PDFs.

  • Error message says need Adobe reader 8 or 9 installed to open pdfs from web pages yet Reader 9alredy

    Error message says need Adobe reader 8 or 9 installed to open pdfs from web pages yet Reader 9 is alredy installed on computer. Is this a 64 bit ossue although I am sure I did not have this problem prior to a replacement hard drive being installed.

    What is your operating system, browser?
    What is the exact message you are getting?

Maybe you are looking for