How to open a pdf file in a web browser using jsp

Hi,
I have a problem opening pdf file in browser using jsp.the following is my code.Can anyone help me.Thanks
response.setContentType("application/pdf");
String filename="C:\\FictPos\\mypdf.pdf";
File file = new File(filename);
FileInputStream in = new FileInputStream(file);
OutputStream out1=response.getOutputStream();
byte[] buf = new byte[4096];
int count = 0;
while ((count = in.read(buf)) >= 0)
out1.write(buf, 0, count);
in.close();
out1.close();
}

Don't know the problem specifically, but here are some suggestions to investigate:
Does it show anything in the page when you view source on it?
I would recommend using a servlet rather than a JSP page for this, if only for the fact the JSPs can insert carriage returns into places where you might not want them to. This might screw up the PDF file format?
Try setting the a link to the jsp, right-click and "save target as..." just to see if it gets any response at all - ie bypass the browser display.
Good luck,
evnafets

Similar Messages

  • How to open a pdf file only in one computer

    I would like to sell pdf publications by allowing  the user to open them only in one computer. I learnt that this has been done  the past when I bought  some publications but I don't know the way to do it. Could you help me?
    thank you
    Marco

    thank you for your support
    Best Regards
    Marco
    Da:     Mylenium <[email protected]>
    Per:    MARCO1 <[email protected]>,
    Data:   09/10/2013 11:09
    Oggetto:        How to open a pdf
    file only in one computer
    Re: How to open a pdf file only in one computer
    created by Mylenium in Downloading, Installing, Setting Up - View the full
    discussion
    You will havwe to sign up for some service that supports rights
    management, use protected PDFs via LiveCyle/ Acrobat Connect or learn how
    to create your own ePub stuff using Digital Publishing Suite. In any case,
    it will probably cost you money upfront before you make any revenue.
    Mylenium
    Please note that the Adobe Forums do not accept email attachments. If you
    want to embed a screen image in your message please visit the thread in
    the forum to embed the image at
    http://forums.adobe.com/message/5746873#5746873
    Replies to this message go to everyone subscribed to this thread, not
    directly to the person who posted the message. To post a reply, either
    reply to this email or visit the message page: [
    http://forums.adobe.com/message/5746873#5746873]
    To unsubscribe from this thread, please visit the message page at [
    http://forums.adobe.com/message/5746873#5746873]. In the Actions box on
    the right, click the Stop Email Notifications link.
    Start a new discussion in Downloading, Installing, Setting Up at Adobe
    Community
    For more information about maintaining your forum email notifications
    please go to http://forums.adobe.com/message/2936746#2936746.
    Il messaggio trasmesso può contenere informazioni di carattere
    confidenziale rivolte esclusivamente al destinatario. Ne è vietato l'uso,
    la diffusione, la distribuzione o la riproduzione da parte di altre
    persone e/o entità diverse da quelle specificate. Nel caso aveste ricevuto
    questo messaggio per errore, siete pregati di segnalarlo immediatamente al
    mittente e cancellare quanto ricevuto.
    This electronic mail transmission may contain confidential information
    addressed only to the person(s) named. Any use, distribution, copying or
    disclosure by any other person and/or entities other than the intended
    recipient is prohibited. If you received this transmission in error,
    please inform the sender immediately and delete the material

  • How to open a pdf file in JFrame

    hi to all,
    i need to know how to open a pdf file in JFrame. Help is needed with this would grateful, and i used the code state below..
    InputStream in=this.getClass().getResourceAsStream("/images/help1.pdf");
    Process p = Runtime.getRuntime().exec(in);Thanks in Advance...

    this is the error which i'm getting while executing the code
    init:
    deps-jar:
    Compiling 1 source file to /home/VEL AREA/SampleApplication/build/classes
    /home/VEL AREA/SampleApplication/src/sampleapplication/Main.java:3: package com.sun.pdfview does not exist
    import com.sun.pdfview.PDFFile;
    /home/VEL AREA/SampleApplication/src/sampleapplication/Main.java:4: package com.sun.pdfview does not exist
    import com.sun.pdfview.PDFPage;
    /home/VEL AREA/SampleApplication/src/sampleapplication/Main.java:5: package com.sun.pdfview does not exist
    import com.sun.pdfview.PagePanel;
    /home/VEL AREA/SampleApplication/src/sampleapplication/Main.java:25: cannot find symbol
    symbol : class PagePanel
    location: class sampleapplication.Main
    PagePanel panel = new PagePanel();
    /home/VEL AREA/SampleApplication/src/sampleapplication/Main.java:25: cannot find symbol
    symbol : class PagePanel
    location: class sampleapplication.Main
    PagePanel panel = new PagePanel();
    /home/VEL AREA/SampleApplication/src/sampleapplication/Main.java:36: cannot find symbol
    symbol : class PDFFile
    location: class sampleapplication.Main
    PDFFile pdffile = new PDFFile(buf);
    /home/VEL AREA/SampleApplication/src/sampleapplication/Main.java:36: cannot find symbol
    symbol : class PDFFile
    location: class sampleapplication.Main
    PDFFile pdffile = new PDFFile(buf);
    /home/VEL AREA/SampleApplication/src/sampleapplication/Main.java:39: cannot find symbol
    symbol : class PDFPage
    location: class sampleapplication.Main
    PDFPage page = pdffile.getPage(0);
    8 errors
    BUILD FAILED (total time: 2 seconds)
    for the reply #4..

  • How to open a pdf file and then attach it with images

    I am new to Indesign Server.
    I'm currently working on a pdf.
    I have a white blank pdf template.
    that I want to attach/glue it with images.
    How to open a pdf file and then attach it with images.
    Please, help me.
    Thanks.

    First step would be to make yourself familiar with InDesign desktop version.
    Whatever you intend to achieve, do it there manually. (see regular app docs or forums)
    Then try to automate your steps with scripting (see scripting docs or forum)
    If you can do it with a script in the desktop version, that script will likely also run in ID Server. (see server forum).
    If you can specify missing features not achievable thru scripting or manual use, reconsider to write a plugin (this forum).
    A seasoned C++ programmer will need a few months to learn the basics, wade thru tons of documentation etc. Alternatively consider to hire a consultant to do the development work for you.
    Dirk

  • How to open a pdf file using OPEN DATASET

    Im trying to convert a pdf into binary format. So im trying to read the contents of the pdf into a XSTRING. Using the FM 'SCMS_XSTRING_TO_BINARY' i can convert the XSTRING to binary format.
    How to open a pdf file using OPEN DATASET and transfer its contents in a XSTRING variable.
    What i've tried is....
    DATA: f_name type string value 'C:\rep_output_pdf.pdf',
          x1 type xstring,
          LT_DATA TYPE STANDARD TABLE OF X255.
    OPEN DATASET f_name FOR input IN BINARY MODE.
    READ DATASET f_name INTO x1.
    CLOSE DATASET f_name.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
        EXPORTING
          BUFFER     = x1
        TABLES
          BINARY_TAB = LT_DATA.
    Im getting a short dump .
    Short text: The file is not open.
    Plz help me out.

    Hello Rajesh,
    You are trying to do use OPEN DATASET with a local file. NOT POSSIBLE
    You have to have the file in the app server to use OPEN DATASET.
    BR,
    Suhas

  • How to open a PDF-File in a browser with 50% screen view and without any modification rights?

    Hello everyone,
    i have the following problem. I would like to open a PDF-file on my web-page in a new window but this file should be shown without any option to Print, Save, Copy or resizing option (Increase and Decrease in percentage size).
    Is this actually possible. The perfect solution would be if the the buttons to print, save, copy, increase/decrease would not only be disabled but completely blinded out. My perfect solution would look like below so that the user can only navigate through the pages but he/she cannot do anything else.
    Hopefully, someone can help me out.
    Thank's a lot,
    Jo

    Hi Alexandre,
    I don't think this is possible with the current APIs that
    HTMLLoader exposes. (Unless webkit supports object tags that takes
    the source data in base 64 encoded form, which I think is unlikely)
    But it is a good feature to have. Please file a feature
    request at
    http://www.adobe.com/go/wish

  • Cant open pdf file ..it says....the adobe/acrobat reader that is running can not be used to view PDF files in a web browser. please exit adobe/acrobat reader and exit your web brouser and try again

    cant open pdf file ..it says....The adobe/acrobat reader that is running can not be used to view PDF files in a web browser. please exit adobe/acrobat reader and exit your web browser and try again

    -> [[Troubleshooting extensions and themes]]
    -> Clear Cookies & Cache
    * https://support.mozilla.com/en-US/kb/Template:clearCookiesCache
    -> [[How to clear the cache#w_clear-the-cache|Clear the Network Cache]]
    '''Plugins Updates'''
    Your Flash plugin is quite older. You need to update it.
    * Adobe Flash Player 11.0.1.152 (3.59 MB)
    * http://get.adobe.com/flashplayer/
    Your Java plugin is quite older. You need to update it.
    * Java Version 6 Update 29
    * http://java.com/en/download/index.jsp
    * [[Using the Java plugin with Firefox]]
    -> Update All your Firefox Plugins
    * https://www-dev.allizom.org/en-US/plugincheck/
    * http://www.mozilla.com/en-US/plugincheck/
    '''When Downloading Plugins Update setup files, Remove Checkmark from Downloading other Optional Softwares with your Plugins (e.g. Toolbars, McAfee, Google Chrome, etc.)'''
    Check and tell if its working.

  • Unable to open .pdf in Firefox 3.6.8 with Adobe Reader 9.3.3 installed. Error message is "The Acrobat/Reader that is running can not be used to view PDF files in a web browser."

    I am unable to open a PDF file in Firefox 3.6.8. Adobe Acrobat Reader 9.3.3 is installed. I get the error message "The Adobe Acrobat/Reader that is running can not be used to view PDF files in a web browser."

    You can get that error if there is still an old Adobe Reader plugin in the plugins folder in the Firefox program folder.
    C:\Program Files\Mozilla Firefox\plugins\nppdf32.dll
    See also http://kb.mozillazine.org/Adobe_Reader

  • Reader 9.2 - "can not be used to view PDF files in a web browser"

    Hello,
    I recently deployed Adobe 9.2 within our organization. I used the Adobe Customization Wizard 9 to transform the install set, and selected the "Display PDF in Browser" option as default.
    When opening a PDF linked from a web URL, we get the message: "The Adobe Acrobat/Reader that is running can not be used to view PDF files in a Web Browser. Adobe Acrobat/Reader version 8 or 9 is required. Please exit and try again." This occurs under IE8 and IE6, in both Windows XP SP2 and Windows 7.
    If I launch Adobe Reader and unselect "Display PDF in Browser" in preferences, PDFs open normally.

    I think I have discovered the answer to my own question!
    I have disabled Adobe Reader plug-in, and can now see PDFs in Chrome.
    (Steps: Chrome Menu, Settings option, Click Advanced Settings link, then Content Settings button, then select Disable Individual Plug-Ins, and a list of plug-ins is offered to enable or disable).
    I then get a different result depending on whether or not Chrome PDF viewer is enabled - with it enabled I see the PDF document in Chrome, or with it disabled then the option is offered to download it, but either way I can get it it via Chrome without having to run Internet explorer in another browser window.

  • Adobe 9.1.3 and FireFox 3.5.1+ "...can not be used to view PDF files in a Web Browser"

    This is the issue but I'm not sure there is a resolution:
    Firefox:  Version 3.5.1
    Adobe: Version 9.1.3
    When navigating the web, click a URL that opens a PDF inside the browser and you get an error * "The Adobe Acrobat/Reader that is
    running can not be used to view PDF files in a Web Browser".  Please exit Adobe Acrobat/Reader and exit your Web Browser and try again".  I did read a post that doing a "repair" from the Adobe Reader application should fix this, they also reference a few registry keys to check becuase the post states it's lost the application path to Adobe version X.  I don't necessarily buy that "fix" and here are my details below.
    In FireFox if you navigate to Tools > Options > Applications > Adobe Acrobat Document
    You're given choices:
    Always ask:  DOES NOT WORK, produces afore mentioned error *
    Save File:  Works, saves the file to a directory on your PC
    Use Adobe Reader 9.1 (defau...:  Works, opens your PDF's outside of your web browser
    Use Adobe Acrobat (in Firefox):  DOES NOT WORK, produces afore mentioned error *
    Use other...:
    IE seems to just work as expected.
    If you open Adobe Reader > Edit > Preferences > Internet > Check "Display PDF in browser" - DOES NOT WORK, produces afore mentioned error *
    This would seem to be an Adobe error rather than a FireFox web browser problems since FireFox does seem to know the correct path although I suppose you can't rule out that this is a FireFox problem since 2 out of the 4 PDF open options DON'T WORK.
    Any thoughts on this issue would be greatly appreciated.
    Other information:
    Adobe 8.1.5 works perfectly with FF 3.5.1+ when opening PDF's in the web browser, we also had no problems with previous versions either.
    MSI push via Active Directory from Adobe 8.1.5 upgrade to Licensed Distribution I signed up for, Adobe 9.1.3 which was upgraded from 9.1.0, to 9.1.2, to 9.1.3 via an MSP patch.
    Operating system:  Windows XP SP 2, plenty of RAM, plenty of Drive
    IE version this works with the new version of Adobe 9.1.3 is version 7 (7.0.5730.13)
    Our FireFox MSI's come from Front Motions website and as far as I know we've never had problems with their MSI's, also tried the new release of FF 3.5.2 from their website.
    I think that about covers it.  Anyone else experiencing the same problems or have a patch?

    After troublshooting this for the entire day today the issue seems to be a MIME problem.
    If everything is woking perfectly, in Tools > Options > Applications...
    You should see 4 or more things related to Adobe like "Adobe Acrobat Forms Document", etc.  If you don't see at least 4 MIME entries either your Adobe installation is hosed or your FF installation is hosed.  I haven't figured out which is causing the issue.
    What I did was remaster my patches from my original Adobe 9.1.0 MSI with the two updates via the command line in the directories with the source files.  On the 9.1.0 original file I first remastered my MST transform with the Adobe MST utility.  I then applied my patches.
    msiexec /a AcroRead.msi /p AdbeRdrUpd912_all_incr.msp
    msiexec /a AcroRead.msi /p AdbeRdrUpd913_all_incr.msp
    I then uploaded that to my network share, unlinked my group policy, made a new group policy, added a batch file to delete adobe.com from program file and the desktop on system startup even though my MST was supposed to take care of that - it's not a perfect world is it?  :-)
    I then reapplied my GPO's for both FireFox 3.5.2 and Adobe 9.1.3, I checked to make sure the MIME extensions were there and they were.  You might have to go into your Adobe Preferences and select that open in browser setting depending on what happens or adjust your MIME settings in FireFox's options but it should work.
    That's what worked for me.  It's possible a few other things I did along the way tweaked it out, in my group policy on the first run I did select to upgrade previous group policies, for the remaster and repush I didn't select any previous GPO's to upgrade.
    It's hard to tell what one thing tweaked it out or what combination of things tweaked out the install.  I did also reinstall Adobe 8.1.5 and FF 3.0.10 before doing all this since our machines currently have that setup, I'm not sure if that affected it either, it's just hard to tell but I don't think it did simply because I had done that several times in troubleshooting this issue.
    If anyone else has more specifics that would be great!

  • Cannot view PDF files in a Web Browser

    When I click on a link in IE 7 it's supposed to open a PDF page but I keep getting error message:
    "The adobe acrobat/reader that is running can not be used to view PDF files in a web browser.  Adobe Acrobat/Reader version 8 or 9 is required. Please exit and try again"
    However, I have Adobe Acrobat 9 Pro installed on my machine, so I think it should work. After all, it's the pro version. Do I need to download/install Adobe Reader 8 or 9?  If so, why, since I've already got Pro 9 installed.
    What can I do to get passed this?  This task is part of an online course I'm taking per work requirements.
    thx,
    John

    Under help there is an option for repairing an installation. You should give that a try.

  • Visual Studio 2013. Viewing a PDF file via the Web Browser control in Windows 8.1

    I am writing a Windows Forms application in which I need to view PDF files via the Web Browser control. When the control is given the Navigate() command, Windows takes over and asks which program I want to open the file with. All was fine with VS 2010 and
    XP. I have un-installed "PDF Complete", which was the default PDF viewer, but I now get asked for an alternative.
    Thanks in advance.
    Mike Saunders

    Hi Mike,
    It seems that we could use Internet Explorer to open a local .PDF file if it has the Adobe Reader. I doubt that the web control would be related to it. Like the MVP's suggset in the following thread, maybe it would be related
    to certain plug-in tools in your side like the adober reader.
    Reference:
    https://social.msdn.microsoft.com/Forums/en-US/a717117e-41ae-4775-9c28-d5a1042b396e/pdf-is-not-opening-in-web-browser-control-in-vbnet?forum=vbgeneral
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Acrobat plug-in. I get this when try to opem. The Adobe Acrobat/Reader that is running can not be used to view PDF files in a Web Browser. Please exit Adobe Acrobat/Reader and exit your Web Browser and try again. Don't problems w/ Internet Explorer-

    Acrobat plug-in.
    The Adobe Acrobat/Reader that is running can not be used to view PDF files in a Web Browser.
    Please exit Adobe Acrobat/Reader and exit your Web Browser and try again.

    See if you can find a NPPDF32.DLL files in the Firefox program folder (C:\Program Files\Mozilla Firefox\)
    You can see the installed plugins on the about:plugins page.
    * http://kb.mozillazine.org/about%3Aplugins
    You can set the pref plugin.expose_full_path to true on the about:config page to see the full path of plugins on the about:plugins page.
    It is best not to leave that pref set to true as it exposes that full path to web servers, so reset that pref to false after you are done with the about:plugins page.
    You can open about:plugins and about:config via the location bar, like you open a website (about: is a special protocol to access some build-in pages).
    If you get a warning when opening the about:config page then you can confirm that you want to continue.
    See Manually uninstalling a plugin:
    * https://support.mozilla.com/kb/Troubleshooting+plugins

  • The Adobe Acrobat/Reader that is running can not be used to view PDF files in a Web Browser. Please exit Adobe Acrobat/Reader and exit your Web Browser and try again.OK. I followed the instruction and the problem still persists.

    I got the following pop-up when I tried to open an online PDF file:
    The Adobe Acrobat/Reader that is running can not be used to view PDF files in a Web Browser.
    Please exit Adobe Acrobat/Reader and exit your Web Browser and try again.
    I tried many time, and it really doesn't work.
    The plug-in I have is Adobe Acrobat 8.3.0.280

    After I upgraded to Firefox 5, I had the same problem and I did a work around temporarily. I went the tools menu, then Add-ons, then clicked the "Plugins" on the left side (4th one down). I "disabled" both Adobe Acrobat 8.3.0.280 and Adobe Acrobat 10.1.0.536 using the disable buttons on the right side. PDF files now open again. However they are outside the actual browser.
    My guess is that Adobe didn't catch up yet with a new update to work with Firefox or vice versa.
    Hope that helps!
    Michael

  • Chrome - Adobe-Acrobat/Reader can not be used to view PDF files in a web browser.

    I can't view PDF files via Chrome (it works on Internet Explorer but I prefer Chrome)  -  the error below has arisen recently on Chrome, though I can't see what has changed.
    "Acrobat plug-in
    The Adobe-Acrobat/Reader that is running can not be used to view PDF files in a web browser. Please exit  Adobe Acrobat/Reader and exit your Web Browser and try again."
    I have looked through Forum articles on similar errors and have tried the following(text copied from other Forum entries)
    Repair Adobe Acrobat (from Acrobat)
    Repair Adobe Acrobat (from Control Panel
    Configure Acrobat  as a helper application: Choose Edit > Preferences., Select Internet on the left., Deselect Display PDF In Browser Using [Acrobat application], and then click OK.Quit Acrobat or Reader
    Create a registry item for Acrobat: with Regedit: If the registry item doesn't exist on the system, do the following: Go to Edit > New > Key and create the missing HKEY_CLASSES_ROOT\Software\Adobe\Acrobat\Exe.Go to Edit > New > String Value and name this key (Default).Select (Default), and then go to Edit > Modify. Type the Adobe Acrobat path in the "Value data" for your product.,restart your computer
    Repair the HKCR\AcroExch.Document registry key: Navigate to HKEY_CLASSES_ROOT\AcroExch.Document., Right-click AcroExch.Document and select Delete; make sure that you have the correct key, and click Yes on any prompts, Right-click AcroExch.Document.7 and select Delete; make sure that you have the correct key, and click Yes on any prompts. Repair your Acrobat  installation
    None has solved the problem. However it still works ok with IE. But I want to stick with Chrome because I find IE is so slow!
    I am using Vista, with Adobe Acrobat standard 9.5.2 and Google Chrome version 23.0.1271.64 m which is marked on Chrome as 'up to date'
    Does anyone know why I might be getting this error on Chrome but not IE?

    I think I have discovered the answer to my own question!
    I have disabled Adobe Reader plug-in, and can now see PDFs in Chrome.
    (Steps: Chrome Menu, Settings option, Click Advanced Settings link, then Content Settings button, then select Disable Individual Plug-Ins, and a list of plug-ins is offered to enable or disable).
    I then get a different result depending on whether or not Chrome PDF viewer is enabled - with it enabled I see the PDF document in Chrome, or with it disabled then the option is offered to download it, but either way I can get it it via Chrome without having to run Internet explorer in another browser window.

Maybe you are looking for