Trying to display a pdf inline, in a new window.

Hello
I have a servlet with the following html button.
<FORM NAME=download ACTION=/servlet.ShowReportServlet METHOD=get>
<INPUT TYPE='submit' VALUE='Display Report A' NAME='Report'>
When this button is pressed, a pdf file is displayed via the following code
// Store the uploaded file size
     int filesize = bis.available();
     // Set content type to application/pdf for Adobe Acrobat Reader
     response.setContentType("application/pdf");
     // Content-Disposition is a field to specify presentation of
     // entity or file name (incase Acrobat Reader plug-in not installed)
     response.setHeader(
          "Content-Disposition",
          "inline; filename=\"" + fileToUpload + "\"");
     // Do not cache the pdf file
     response.setHeader("Cache-Control", "no-cache");
     // Set the content length
     response.setContentLength(filesize);
     // Upload the file to the client
     ServletOutputStream sos = response.getOutputStream();
     int data;
     while ((data = bis.read()) != -1) {
          sos.write(data);
My problem is that I can't work out how to display the pdf in a new browser window.
Any help would be greatly appreciated.
Thankyou.

Thanks for pointing me in the right direction DrClap.
We ended up with the following html (in an HttpServletResponse):
<FORM NAME=download ACTION=/servlet.ShowReportServlet METHOD=get TARGET="ReportWindow">
<INPUT TYPE='submit' VALUE='Display Report A' NAME='Report' OnClick="window.open('','ReportWindow','height=530,width=550,menubar=0,resizable=1,scrollbars=1, status=0,titlebar=0,toolbar=0,left=300,top=100')">

Similar Messages

  • With acrobat 7, how do I make links (within the pdf) open in a new window-tab?

    With acrobat 7, how do I make links (within the pdf) open in a new window-tab?

    No love? From anyone?

  • Display PDF files in a NEW window

    hi there
    i offer PDF files to download on most of my webpages. example: http://www.khanomTOPproperty.com/khanomTOPproperty.com/northofkhanom.html
    i would like them to load in the browser first (not automatically download), but in a NEW WINDOW, and then give the visitor the option to download it (which is the easy part of it).
    even if i don't focus on opening in a new window (which is what i have now online, to make it available at last) the problem is that not all browsers display the file. some download it immediately. it took me quite a while to find out how different browsers handle it, and since it is very different i made a "browser ABC" help page on my site, explaining the different behaviors of browsers (http://www.khanomTOPproperty.com/khanomTOPproperty.com/browser_help.html). safari is great as usual and displays the file, so one can downoad it then (or not), but google chrome (and others) immediately download them without displaying them. by the way, i did NOT zip the files.
    so, how to make it sure that the files are displayed (not directly downloaded) in every browser, and, as mentioned above, i would love to have it in a NEW WINDOW( or tab, but better window), to make it easy to go back to the previous page without having to reload.
    and yes, i too think ISSUU is great in terms of display, i tried it but immediately forgot it when i found out that the visitor has to log in first (actually become a member of ISSUU) before being able to download - and i don't want to force my visitors to such things - the same way i will never have any advertisement on any of my pages - i don't want to make visitors angry...
    thanks again, i know - lots of questions, but the result of a few weeks iWeb work, and i did not find the answers in the forum yet.
    george

    hi wyodor
    oh wow, you answer almost faster than i can ask - that's what i call turbo.
    sounds very simple, and i tried it. the problem is that it is not so easy to make this link. i tried to find one of the several PDF files i have to make a test, but even this was not so easy. in cPanel i have a window which pops up when i open the file manager. it gives the option to access through
    a) home directory
    b) web root (public_html/www)
    c) public FTP root (public-ftp)
    d) document root for:
    (and then the domain names)
    which one is the right one to enter if i want to go to my PDF files? yes, OK, not an iWeb question, but maybe you can...
    anyway. i managed somehow to get to the PDF files. to my surprise i have seen that each file is there not only one time, but twice (the second time with a "_1"PDF. any idea what happened there? i only need one, do i?
    OK. so i found one, localized it but still can not get the link for it. the only link i find (in the browser address bar) is the FOLDER where the PDF files are located. i don't think this will do it, as i guess i have to specify the file exactly, otherwise how can iWeb know which file i want?
    how can i get a link to this file?
    additional question: whenever i update my website, will this path be remembered? i guess so.
    practically this means i will (should i be successfull and be able to create a link to these files) have to upload the PDF files BEFORE i can create the link in iWeb, Yes?
    you see, i am really a professional (...) - if i would i would probably switch to the other side and help greenhorns like me in the forum.
    by the way - are aou working for apple or is this just some sort of hobby?
    thanks again and warm regards
    george

  • How to display interactive PDF  form in an external window?

    Hi Gurus,
    I have developped an application which involves interactive form . Now I want to display the pdf generated through the interactive form in an external window.
    Please guide me how to goahead.
    Thanks
    Nageswara.

    Hi Francois Gendebien ,
    Thanks for ur reply.
           But I have created Pdf in new window(by using window instance) but That window does not contain minimise and maximise and close button.
    Is there any suggessions to add these Options to created new window pdf form
    I am  strucking over here .
    Please help me out.
    Thanks
    Mandapati

  • Opening a pdf document in a new window on click of commandLink in ADF

    Hi,
    I am having a command link in my page and on click of that i am calling a webservice and getting the contents as bytes and writing the contents to the response outputstream. And i followed the below given steps. Everything works fine and i am getting the PDF displayed in new window. But i am getting a pop up blocker issue in IE and Firefox. Is there any workaround for that?
    1: open a dialog , and get url of servlet
    <af:commandButton text="Dialog Report" id="cbdialogReport"
    action="#{ReportBean.cbdialogReport_action}"
    useWindow="true" windowHeight="1000"
    windowWidth="1100"/>
    public String cbdialogReport_action() {
    try {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ExternalContext externalContext =
    facesContext.getExternalContext();
    HttpServletRequest request = (HttpServletRequest)externalContext.getRequest();
    String strUrl = request.getRequestURL() + "";
    int iPosition = strUrl.indexOf("/faces/");
    strUrl = strUrl.substring(0,iPosition+6) + "/doreport";
    this.reportURL = strUrl;
    System.out.println("strUrl=" + strUrl);
    //System.out.println("request.getRequestURI()= " + request.getRequestURI());
    return "dialog:ReportDialog";
    } catch (Exception ex) {
    System.out.println(ex);
    return null;
    2:diaolog
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1">
    <af:form id="f1">
    <af:panelStretchLayout id="psl1">
    <f:facet name="bottom"/>
    <f:facet name="center">
    <af:inlineFrame id="if1"
    source="#{ReportBean.reportURL}"/>
    </f:facet>
    <f:facet name="start"/>
    <f:facet name="end"/>
    <f:facet name="top"/>
    </af:panelStretchLayout>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    3: create a serlet
    package com.pansoft.myerp.servlet;
    import com.pansoft.myerp.view.Function;
    import java.io.File;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.io.PrintWriter;
    import java.sql.Connection;
    import javax.faces.context.ExternalContext;
    import javax.faces.context.FacesContext;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import net.sf.jasperreports.engine.JasperRunManager;
    public class doReport extends HttpServlet {
    private static final String CONTENT_TYPE = "text/html; charset=UTF-8";
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    /**Process the HTTP doGet request.
    public void doGet(HttpServletRequest request,
    HttpServletResponse response) throws ServletException,
    IOException {
    try
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ExternalContext externalContext =
    facesContext.getExternalContext();
    //String strUrl = request.getRequestURL() + "";
    //System.out.println("URL: " + strUrl);
    response.setContentType("application/pdf");
    response.addHeader("Content-Type", "application/pdf");
    //response.setHeader("Content-Type", "application/pdf");
    //response.addHeader("Content-Disposition", "inline;filename=Report.pdf");
    Function function = new Function();
    Connection conn = function.getCurrentConnection();
    OutputStream outputStream = response.getOutputStream();
    InputStream reportStream = externalContext.getResourceAsStream("/Report/rptChar.jasper");
    JasperRunManager.runReportToPdfStream(reportStream, outputStream, null, conn);
    outputStream.flush();
    outputStream.close();
    //facesContext.responseComplete();
    }catch(Exception ex) {
    System.out.println("doGet():" + ex);
    Thanks!
    Ram

    I think you can't anything do about it if your popup blocker prevents the page to open.
    Some such blockers allow to add white lists of url which are allowed to open popups.
    Timo

  • How To Make Links In A .PDF Open In A New Window

    Hello,
    I am using Acrobat Pro 10 to create a fillable employment application. At the top of the main application, I want people to be able to click and be redirected to another .PDF file I have hosted on my site that they will need to fill out in addition. So, I have used the link tool, but this closes the main pdf application and opens up the new pdf in its place. This is very problematic, because it clears out all of their data in the previous main application. So, I need the link to open in a new window and not in the same one as the original form. Is this possible?
    I have tried using the Java work around explained in this article: http://mythinkpond.wordpress.com/2009/11/04/opening-a-link-in-a-pdf-document-in-a-new-wind ow/
    However, when I do this, and upload it to my site the link doesn't do anything. When you click above the word where the link should be, it doesn't show the finger pointer and doesn't do anything when clicked.
    Any ideas? I greatly appreciate any help...

    That makes sense. So I guess it looks like I have 2 options.
    1. Put the JS short code in and have it open the link in a new window if the user opens it in adobe. If a google chrome user opens it in the default viewer, they wont be able to use the link at all.
    2. Leave the link how it is, and it will be usable in both viewers, but will not open it in a new window.
    I am sureprised that opening the link in a new window isn't just an option in Acrobat Pro. I wouldn't think you'd have to make a workaround like this.
    Is there an alternative way to have a page link on the form so that people can go to another .pdf whil keeping the main one open?

  • How do you open link to a file contained in a PDF portfolio in a new window?

    I am making a large PDF portfolio with one main document that links to other documents contained inside the portfolio. The problem is when I select a link, it will take me to the document I would like it to but I cannot move back to the main document as easily as I would like to. Is there a fast "back" option, or can I set the link to open in a new window? I know I can move to the list view, hit the back button, re-open the main document, and find the same page again but that is not a very quick method.
    I know how to set the link to open in a new window if I am opening a new file, but that option is not available if I would like to jump to a specific page contained within the document. I tried to "open a file" and select the portfolio but it won't allow me to set the page so that didn't work either. Any help or suggestions would be appreciated.
    Thank you!

    Hi fmalek17,
    Firstly, there is no such 'back' option in a portfolio. You might need to set a link in a similar way in the other document also for going back to the main document in a portfolio.
    Secondly, you need to select 'Go to a page view' option in the Create Link window to jump to a specific page. Unfortunately, there is no such option available in Acrobat via which you can go to some specific page of the same document which gets opened in another window.
    Regards,
    Anubha

  • Displaying Search iview results in a new window

    Hi,
    I am using a basicsearch iview to search a folder. Now, when I do a search I want the results to open in a new window. I was going over some questions in the SDN Forum and for the option "Launch in New Window", I did select Display in Seperate Window. Still, the results are not showing up in a new window. Is there anything else which needs to be done? I did create the component and options set. Does the Layout Set for Search Results play any role here? I am not very familiar with it and hence I have not done any configurations for it. Can anyone please point me in the right direction? Thanks for your valuable time and effort.
    Sincerely,
    Sri

    Hi Sri,
    The content in our implementation (project) is not transported yet, so I don't know if any problems will arise. But I just found a document which descripes a transport procedure. You can find on the SDN KM&C homepage or via this link: https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/ep/6.0/best practice for transporting sap netweaver portal content.pdf
    Hope it helps solving your problems.
    Best regards,
    Eric

  • Open a pdf file in a new window

    How do you have a pdf file open up in a new window in
    DW8?

    If you are coding a page with a HTML Transitional doctype,
    you can link to
    the PDF file, and assign a target="_blank" option to the
    link. If you are
    coding a page with an XHTML doctype, then you would need to
    do this
    differently if you want the page to validate.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "omealh" <[email protected]> wrote in
    message
    news:giocbd$rm6$[email protected]..
    > How do you have a pdf file open up in a new window in
    DW8?

  • InDesign Button Action for PDF – Open File (in new window)

    I am using the 'Open File' action on buttons in a document i am making which will eventually be a PDF, but am wanting to specify the button action to open the file (another PDF) in a new window.
    I have found that I can achieve this and add button actions with this specific behavior in Acrobat, but it seems to be missing in indesign's abilities as far as I can see. Is there a way to do this in indesign so that i do not have to tinker in acrobat after I have made my PDF. As if I have changes to the PDF, all buttons then have to be totally re-done each time, and i will have possibly 900 buttons!!
    Thanks.
    (Using indesign CS4)

    Jeff,
    You are correct. I want to have a DVD with multiple PDFs. The main one almost acting as a table of contents for the rest.
    Problem = the 'main one' is 62 pages long, many hundred buttons and every page has at least a few of these links needed.
    Which means, if you are correct (and I believe you are, hope you aren't) that I need to custom code these buttons in Acrobat.
    The method is easy, but x300 = painful. And then the kicker... Boss says, 'Change slide 30' ... which means: Back to InDesign, Export to PDF, Recode ALL BUTTONS.
    *Note, there are some 'interactive' buttons with roll over states. So I don't think replacing the pages would work.

  • Interactive PDF, open file in new window.

    Hello everyone,
    I was unable to find this on the net or I could be using the wrong typed search. Created a successful interactive document. I attached a portfolio to this interactive document. I have 3 images. Two are hyperlinked to specific urls which work just fine. I have a sample button which opens the pdf. The only problem I have is that the pdf open in the current pdf window of the past file, so one has to reopen the original file again to access it. I could create a button on the portfolio webpage to go back to the original document, but that would be 20 buttons.
    Is there a way for someone to click on the sample button, but open up a new window like you would for a webpage?
    Right now the setup in the Buttons and Forms window:
    Sample button
    Type: button
    Name: Sample
    Event: On Release or Tap
    Open File - Checked
    Select File: current path
    PDF Options
    Description: Portfolio Samples
    Printable - Checked.
    That is pretty much it.

    Not everything can be done in InDesign when it comes to interactivity and forms. I believe you have to use a JavaScript in Acrobat to get the file to open in a new window. I can't provide you a specific reference. Ask on the Acrobat forums.

  • PDF files open in new window.

    Whenever I click the "Open" button in Reader 9, (Windows 7 - 64-bit),
    it opens the document in a new instance of Reader, which of course,
    makes the menu item "Window" useless. How can I get docs to open
    in the same window? I don't see any setting for this in the preferences.

    ComputerWhiz
    "Make sure the Open new windows in a new tab instead is checked" - it is.
    issue still not solved,
    ps if you click on a pdf on the above link do you get the same problem or is it just me..?
    [Lewis Hamilton]

  • PDF output in a new window.

    Hi All,
    Thers an application in MVC where on clicking a button a popup comes with three options OPEN/SAVE/CANCEL .If the user clicks the OPEN button , a new window comes up with the PDF file icon in it .On clicking this PDF File icon the PDF document is opened in a new window.
    Is it possibel to open the PDF document directly in a new window without giving the popup for OPEN/SAVE/CANCEL options?
    I mean as soon as the user clicks the button the PDF document should open in a new window.
    Thanks in advance .

    Hi Raja,
    Many thanks for the reply.
    I will go through the web logs and try out the solution.
    I hope i ll make it.

  • Flex Bug - Cannot display full screen video in a new window

    My top level application consists of a login screen. When the user logs in successfully, the main application is closed using "this.close()" and a new Window() is opened. Inside the new window I've added the VideoPlayer component and specified a source.
    When I run the application, everything worked as expected. However as soon as I click the full screen option on the VideoPlayer, Flex says:
    Error: Error #3200: Cannot perform operation on closed window.
        at flash.display::Stage/desktop_set_displayState()
        at flash.display::Stage/set displayState()
        at spark.components::VideoPlayer/fullScreenButton_clickHandler()[E:\dev\4.x\frameworks\projects\spark\src\spark\components\VideoPlayer.as:2233]
    Inside the VideoPlayer.as file I've found what I think is the problem:
    2204: // add as a popup
    2205: PopUpManager.addPopUp(this, FlexGlobals.topLevelApplication as DisplayObject);
    I commented out line 2205 and added a new line:
    PopUpManager.addPopUp(this, parentApplication as DisplayObject);
    However I get the same error and it still says the problem is at line 2233 as well, even though line 2233 now reads (due to the additional line I added above):
    // TODO (rfrishbe): Should we make this FULL_SCREEN_INTERACTIVE if in AIR?
    I cleaned my project via the Project menu but I still get the same error message. Any idea how I can resolve this problem?

    Doesn't anyone know?

  • HTML Container - pdf-file opens a new window

    I use the ITS Webservice PZ04.
    There is included a html container who shows the pdf-file inside this area.
    Now I have the effect, that this pdf-file will opena a new window, but not inside the html container!?
    First action before I have had this effect was the MS question-alert 'How you will open this file' Open/Download/Cancel - you know. - it never done before -
    What can I do to open my pdf-file inside the html container? It runs some times.
    Thanks!

    thank you for your answer, but it wasn't the solution.
    I don't open the iView in a new window.
    I open the iView (as IAC WebService via ITS) and the applacation generated a html container with pdf file!
    And this pdf-file opens in a new window.
    The Application runs up to now very good.
    I think any value was changed and I don't know which.
    It's possible the modification solved under MS or adobe!?
    Solution: First Deinstallation and then Installation of Acrobate Reader.
    Message was edited by: Ronald Kohn

Maybe you are looking for

  • How get selected data from oracle data as per give input

    sir i use Sun Java Studio Creator with oracle 10g my direct want user give input through both listbox , textbox or string variable how i pass this input in sessionbeen query and page give data in table as per user need please give me step and code th

  • Extended notifications and UWL

    Hi Friends,   I am using Extended notifications for sending notifications to lotus notes. In the notification we can maintain shortcut to open the workitem in SAP GUI. But the users use only UWL to access work items.So Is there any way to maintain th

  • Pass BP number through partner function in Lead

    HI,    We are creating lead from BP screen. when we click the new button in the Lead Assignment block a list of lead types appear whrn i select one type the lead opens with the BP as sales prospect in the lead. We have a requirement to validated the

  • Hot deployment in WL 8.1

    Hi All, I am deploying the application from my development dir "c:\development" as exploded for WAR file and EJB modules as JAR files. What should I do to make the hot deployment work? My environment is: Win XP, IDE is JBuilder(also use Eclipse3.0),

  • Movie Controls Not Showing

    Hello Everyone, Here is the problem: I have posted movies to my web page, but the fast forward & reverse buttons at the bottom right of the movie are not showing up. I originally had kioskmode set to on, but have removed it since. I also tried export