Opening pdf and excell on an acrobat or xls sheet from a servlet

Hi all
I have a servlet that generates a pdf or excell as per the file type passed , the problem i am facing is the excell and the pdf file opens on the browser itself. Is there anyway of opening the pdf / excell on their applicaitons (ie on Acrobat reader or Microsoft excell). Or promting the user to save.
regards
riaz
NOTE: My servlet code is as below
public synchronized void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
Log.skip();
Log.write("Servlet posting...");
try
     String filename = request.getParameter("DownLoad");
     File file = new File(filename);
String lsContentDisposition = "inline; +filename=\"" filename + "\";";
response.setContentType("application/pdf");
     response.setContentLength((int)file.length());
     response.setHeader("Content-Disposition", lsContentDisposition);
java.io.FileInputStream fis = new java.io.FileInputStream(file);
     int i = 0;
     javax.servlet.ServletOutputStream out =response.getOutputStream();
     while((i=fis.read()) != -1)
          out.write(i);
          out.flush();
          out.close();
          fis.close();
          response.flushBuffer();
     catch(Throwable t)
     System.out.println("---DownLoadFile--:" + t.getMessage() );
     }

Probably the browser for security reason will not open those application unless the user specifically ask it to do it. One way you can do is put a hyperlink to those files in your generated pages and let the user click on it, at which moment depending on the configuration of the web browser will open the right application.
Hope this help.

Similar Messages

  • Where does workspace store the pdf and excel file ?

    Hi,
    I'm working on a Web Analysis project and I have created a dynamic web menu based on the workspace repository to improve the poor capacities of WA in terms of menu. I use the javascript API to control the WA applet from the menu.
    Now my problem is that my customer created a folder in workspace (which is translated into a sub menu of my dynamic menu), and that folder contains pdf and excel files. The function openFile which I use to open report in the applet doesn't work on pdf and excel files. So I've been looking for the files on the server, to know where they are stored, so that I could just modify the java class that generates the menu.
    I couldn't find those files on the server. Where are they ? Are they stored in the database as an xml string like the report s ? If yes then I might have a problem.
    Has anyone already done this ?
    Thanks for your help.
    Cyril

    Tomcat stores it in the work dir under $TOMCAT_HOME.
    There'll be directories like localhost%2f<urcontext>..
    As for as JSP changes being recognized, try refreshing ur browser....

  • Unable to open PDF directly if user use Acrobat 8

    Unable to open PDF directly if user use Acrobat 8.
    We are facing some problems in our production site. When user click PDF icon, "FileDownload" windows pops up, but it only has "Save" or "Cancel" button, so user needs to download and save the file to open.
    I tested the following scenario using
    We have facing problem with this visions IE 6.0 – Acrobat 8.0 and IE7.0 – Acrobat 8.0.
    Mozilla 2.0 – acrobat 8.0 working fine. The pdf contents are embedding fine the browser window
    Does anyone have any experience with something of this nature?

    I must have missed the announcement - when did these forums change from Java language to IE/Adobe/Mozilla forums?

  • PDF and Excel output cell spacing issues

    Hi all..
    I have a report and template whose output should be both in PDF and Excel.
    Lets say I have two tables in out put one below other. (Table1 and table 2 below it..)
    Table 1 has 5 columns and table 2 has 30 columns.
    In PDF since it is difficult and ugly to show 30 columns, I made font as 6( very small font)
    PDF output looks fine. But, when I open the reort in excel..its all messed up and ugly.
    Table 1 column widths are very much uneven. lI noticed that table1, table 2 coulmns width are same...
    For my Requirement, they must have seperate widths.. Also..when I open the report in Excel, I still get in font size 6 which is ugly
    I want table1 column width and table 2 column width in Excel as seperate..
    How do I achieve this.

    Vetsrini wrote:
    you can do that too..
    two set of tables, one for each output. and use the Microsoft word font properties.
    else
    add something like this
    <fo:block font-size="14pt" font-family="verdana" color="red">
    Your test or your field
    </fo:block>Srini, this worked!
    My font differences in Pdf and Excel has been eliminated now.
    But however I have one more problem as I stated in my first post.
    When I exported into Excel, My column width of first table is dependant on the other making my report look uneven.
    I am providing the screen shots.
    Look how Rate column of first table is very huge as it took the colmun width of table2 (Decription column)
    http://i.imgur.com/Rj8CC.jpg
    I need something like this: http://i.imgur.com/nklEN.jpg
    Is this achievable?

  • Report Type for pdf and Excel

    I have following code to generate the report for pdf format.
    I would like to let users to choose report type 'pdf' or 'excel'
    I need pass the user select from user interface to <cfreport format= "PDF" or "Excel".
    Can you please advise how I can pass the user select Report Type from lsReportType to my cfReport?
    Your help and information is great appreciated,
    Regards,
    Iccsi
    <cfstoredproc procedure="spGetReportType">
       <cfprocresult name="rsReportType" resultset="1">
    </cfstoredproc>
    <cfreport format = "PDF" template= "MyReport.cfr" query="#myQuery#">
       </cfreport>
    <td><select width="50" name="lstReportType" id="lstReportType">
          <cfoutput query="rsReportType">
             <option value="#rsReportType.ReportTypeID#" <cfif (isDefined("form.ReportTypeID") AND form.ReportTypeID EQ rsReportType.ReportTypeID)>selected="selected"</cfif>>#rsReportType.ReportType#</option>
           </cfoutput>
         </select></td>

    Change format="PDF" to format="#VariableName#" where VariableName contains the text "PDF" or "Excel".

  • Save as pdf and excel file

    Hi All,
    Can anyone tell me how to save data available in a node(model or value) as pdf and excel files?
    Thanks in advance.....
    Bhushan Reddy.

    Bhushan,
    check these links for saving as excel
    Excel Export - Funky Column Headers
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/webDynproJava-ExportingTableDataUsingOn-DemandStreams-SAPNW+7.0
    Exporting table data to MS-Excel Sheet(enhanced Web Dynpro Binary Cache)
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/webDynproJava-ExportingTableDataUsingOn-DemandStreams-SAPNW+7.0
    Handling FileUpload and FileDownload in NetWeaver Developer Studio(NWDS) 2004S
    New Web Dynpro Java Tutorials - Uploading and Downloading Files in SAP NetWeaver 7.0
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00062266-3aa9-2910-d485-f1088c3a4d71
    Thanks
    Bala Duvvuri

  • Not able to open pdf and adobe reader on windows xp sp3.

    Hello,
    I am not able to open pdf and adobe reader on my windows xp sp3 computer. I have reinstalled adobe reader 11.0.3 twice, but, no luck. I would appreciate if you could help me in resolving this issue. Thanks in advance.
    Regards,
    Venkata

    You can try using this tool to first remove all traces of Reader from your computer:
    http://labs.adobe.com/downloads/acrobatcleaner.html
    Then, you can download the full offline Reader installer from
    http://get.adobe.com/reader/enterprise/
    After downloading, restart your computer and run the installer before doing anything else.

  • Data missing in scheduled report via email as pdf and excel

    Hi,
    I scheduled a webi report to email as pdf and excel, I am getting the mail but on pdf and excel only I can see the report header, values are missing
    Regards
    Aflal

    how come?
    do you have any parameters in this report?
    can you tell exactly the steps u r following doing
    thanks
    Amr

  • Taking zip, pdf and excel file Offline

    Hi All,
    The App has fixed number of zip, pdf and excels (10, 15, 5) files which periodically gets updated, using the updated feature the app updates all the files currently.
    Is there a way where the App can replace all the updated files offline from the server "offline synnchronization" .
    srinath

    Yes, but it's very complicated and requires a set of custom-made scripts.
    The easiest way of doing it is by converting the Excel file to a plain-text
    file (like a CSV file) and then attach that file to the PDF and use it as
    the data source for the script that populates the fields.
    On Mon, Oct 20, 2014 at 4:46 PM, amcwilliamslge <[email protected]>

  • Multiple Mail attachment (PDF and Excel) in a single mail

    Please help me to send the PDF and Excel attachment in the single mail. I am using the FM for PDF is 'SO_NEW_DOCUMENT_ATT_SEND_API1' and for Excel 'SO_DOCUMENT_SEND_API1'. Currently the program sends 2 different attachments for PDF and Excel.
    Thanks in Advance.

    Hi,
    If you want to send multiple attachments in a single mail then i would suggest to use
    CL_BCS for achieving it.
    Look at standard program BCS_EXAMPLE_6 for more clarity.
    There you find this statement of code
    document1 = cl_document_bcs=>create_document
    After creating one document using this you can use the same statement again and create another document.
    document2 = cl_document_bcs=>create_document
    Both documents should have different name.
    Then use
    send_request->set_document( document1 ).
    send_request->set_document( document2 ).
    This will attach both the documents to a single email.
    Hope this helps.
    Regards,
    -Sandeep

  • Could 'export button' show only pdf, and excel only?

    Hai,
    I am using report viewer, it has export button in that header.
    Could 'export button' show only pdf, and excel only?
    So the report just only export pdf only or excel only.
    Technology:
    Asp.net Vs2010
    SSRS2012
    Windows 7

    I found the solution:
    http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/74dad27b-ef7e-4b9b-8922-666b317b3094
    This is the additional code, to hide all type of export.
                DisableUnwantedExportFormat((ReportViewer)sender, "XML");
                DisableUnwantedExportFormat((ReportViewer)sender, "CSV");
                DisableUnwantedExportFormat((ReportViewer)sender, "IMAGE");
                DisableUnwantedExportFormat((ReportViewer)sender, "PDF");
                DisableUnwantedExportFormat((ReportViewer)sender, "MHTML");
                DisableUnwantedExportFormat((ReportViewer)sender, "EXCELOPENXML");
                DisableUnwantedExportFormat((ReportViewer)sender, "WORDOPENXML");

  • Template builder for adobe pdf and excel

    Hi All
    I couldnt find plugins and template builders for adobe pdf and excel.
    some pointers pls..
    thanks
    cm

    Rainer,
    I want to use this PDF Templates in EBS, is it possible?.. and also I have 10 sample output pdfs and one RDF for my AR Invoice Report.
    For this scenario do i require PDF Writer Software?.. I am new to develop reports in pdf templates.
    please adivce me
    with regards
    Ram

  • Since I have connected my iPad with the MacBook through ICloud I have problems in Preview of opening PDF- and JPG-files. Does anyone have a solution for this?

    Since I have connected my iPad with the MacBook through ICloud I have problems in Preview of opening PDF- and JPG-files. Does anyone have a solution for this?

    I'm not sure I understand the connection between iCloud and this problem.  Is it simply a problem of coincidental timing (ie, the problem happened after you set up iCloud)?  If so, there's almost certainly no connection between these two events.
    Where are you getting the files you're trying to open, and what specifically happens when you try to open them?

  • Trying to open pdf and Adobe Reader Stops Working...Please Help

    Trying to open PDF and it keeps popping up that Adobe Reader Stopped Working.  And doesn't seem to find a solution to fix.  Has been going on for a couple days.  Can't access pdf files needed for my business.

    With Reader XI I assume you mean 11.0.0; try updating to 11.0.06.
    Also, can you open Reader by itself?  If so, try to disable Protected Mode [Edit | Preferences | Security (Enhanced)].

  • Opening PDF and PPT files without using BuddyApi

    Hi, please excuse my newness.
    I'm wanting to open pdf and ppt files through Director (I'm using 11.5) but I'm struggling with finding the right code to make it work. I saw that a lot of people are recommending Buddy Api. However I'm cheap and was hoping that there would be a way to open files without having to resort to using/paying for this xtra. Is there a reason why opening files in Director seems to be such a hassle?
    Thanks in advance.

    I'll also add that from my understanding, an unregistered version of Buddy API can be used in commercial applications.
    Buddy API is a great Xtra and if you're going to be developing applications with Director, this Xtra will be a valuable purchase. Buddy Xtra is recommended a lot in the Director forums for a good reason.
    Dean
    Director Lecturer / Consultant / Director Enthusiast
    http://www.deansdirectortutorials.com/
    http://www.multimediacreative.com.au

Maybe you are looking for

  • How can I tell how long a request has been sitting on an execute queue?

    Is it possible to determine (in WL 8.1 and/or 10.3) how long an HTTP request has been sitting on the execute queue before being assigned to a servlet? Under heavy load, I'm finding that the caller times out by the time the servlet tries to write the

  • Oracle support for multiple languages

    I have a VB and oracle application. There is a requirement for having spanish language support. The current character set is US7ASCII and National Character set is AL16UTF16. After some analysis i thought changing these character sets to UTF8 will be

  • Can't verify payment info (endless

    I'm trying to purchase apps on my iPhone 6+, but keep getting the "payment info" verification popup. When I tap it, I'm prompted to type in my Apple ID password. I enter the password, but the app keeps requesting it over and over and over. There's no

  • Discoverer Parameters in EUL Tables

    Hi All, In which DB tables the information about the Parameter for each Worksheet of Discoverer Workbooks are stored.Also where are the default values for the parameter stored in the Darabase table? Thanks, HP

  • What version of LiveCycle ES4 SP1 is correct?

    Hello, I have a little question / doubt about what correct LiveCycle ES4 version I'm using. I have installed LiveCycle ES4 and then Service Pack 1 a while ago with no problem. I recently came this doubt. In the Service Pack "Installation Instruction"