How to open pdf files in browser using flex

hi,
my project is having a Document explorer wchich contains pdf
files,iwant to open it in the browser.can any one tell me how to
open pdf documents using flex programming(i tried with different
thing like swf's but my client wants only pdf formatt).

Another option is by calling a JSP page. This example will
open a pdf file into a new browser without displaying the download
"save" prompt.
Function to call the JSP:
private function downloadFlyer(event:Event):void {
var jspLink:URLRequest = new
URLRequest("jsp/downloadpdf.jsp?fileName=Fundraiser_flyer_2008.pdf");
navigateToURL( jspLink, "_blank" );
JSP code:
<%@ page errorPage="error.jsp" %>
<%@ page import="java.io.*" %>
<%
//Get the parameters
String downloadFileName=request.getParameter("fileName");
String fileName = application.getRealPath("/downloads/" +
downloadFileName);
File file = new File(fileName);
if (!file.exists()) {
throw new IOException("File does not exist.");
// Get the size of the file
long length = file.length();
// You cannot create an array using a long type.
// It needs to be an int type.
// Before converting to an int type, check
// to ensure that file is not larger than Integer.MAX_VALUE.
if (length > Integer.MAX_VALUE) {
throw new IOException("File too big.");
response.reset();
response.resetBuffer();
response.setContentType( "application/pdf" );
response.setHeader ("Content-Disposition", "filename=" +
downloadFileName);
//Prevent the Java error: "getOutputStream() has already
been called for this response"
out.clear();
out = pageContext.pushBody();
InputStream in = new FileInputStream(file);
OutputStream output = response.getOutputStream();
try {
int curByte=-1;
while( (curByte=in.read()) !=-1){
output.write(curByte);
} catch (IOException ioe) {
ioe.printStackTrace(System.out);
} finally{
output.flush();
in.close();
response.flushBuffer();
%>

Similar Messages

  • Unable to open PDF file in browser using Reader 9 with IE8

    I just updated to IE8 and when trying to open a PDF file on the browser, I received a message stating to use Adobe Reader 8 or 9.  I downloaded AR9 and still receive the same message and cannot open PDF files in browser window.  It defaults to my Adobe Acrobat 6.0 which will not open the file.  I have Windows XP.  I do not have a problem opening a PDF file in Yahoo mail with AR9.  I have tried many different ideas on the web to no avail.  Appreciate any help to be able to default to open PDF files in the browser using AR9 which is apparently required by IE8.

    Fixed problem by taking to a computer store to find that my hard drive storage was maxed out.  I had the hard drive repaced with a larger amount of storage.   Problem resulted from inadequate amount of storage space which prevented me from downloading and installing Adobe Reader 9.
    Thanks to al that responded.  

  • How to open pdf file in safari using adobe reader

    I am trying to open a pdf file, that is a fillable form, however I get the following message:
    Please wait...
    If this message is not eventually replaced by the proper contents of the document, your PDF viewer may not be able to display this type of document.
    You can upgrade to the latest version of Adobe Reader for Windows®, Mac, or Linux® by visiting http://www.adobe.com/products/acrobat/readstep2.html.
    For more assistance with Adobe Reader visit http://www.adobe.com/support/products/ acrreader.html.
    Windows is either a registered trademark or a trademark of Microsoft Corporation in the United States and/or other countries. Mac is a trademark of Apple Inc., registered in the United States and other countries. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries."
    I have followed the link above and downloaded the new version but I keep getting this message.
    can anyone help?

    it didnt work, i tried chrome as well, but now found a way around it, actually the system was set to open files in the previewer, so I had save as the pdf file and then open it with pdf, and it worked.

  • How to open *.pdf files in BOXI r2 inbox

    I am scheduling as  *.pdf file for deski report.After scheduling i am getting *.pdf in my inbox.if the report is deski or webi we can use FC_REPORT_ENGINE or WI_REPORT_ENGINE to open the report's using java code.In same way how to open *.PDF file in Inbox?
    Edited by: ramkishore kishore on Nov 7, 2008 8:31 AM
    Edited by: ramkishore kishore on Nov 7, 2008 8:31 AM

    Hi Ram,
    Following information might help you to resolve the issue.
    After logging into Desktop Intelligence, you may be presented with a message stating:
    u201CYou have received 1 document from users"
    Examining the Inbox from within the Desktop Intelligence client shows no objects visible in your Inbox.
    The object in your Inbox is in a format other than Desktop Intelligence format such as, PDF, XLS or other format. Therefore the object is not recognized by the Desktop Intelligence client inbox browser.
    Log in to Info View or the Central Management Console, browse to your Inbox and verify the file name and format that has been sent to your Inbox. The object may be saved, copied, moved or deleted as necessary.
    Regards,
    Sarbhjeet Kaur

  • Cant open pdf files in browser

    Cannot open pdf files in browser but can open from hard drive. Using Adobe 11.0.02 with Windows 8. Have uninstalled Reader and reinstalled and then restarted PC; Checked for updates; used the Repair selection on the menu. Frustrated. Suggestions?

    Hi adityabhargava01-
    My first suggestion is to upgrade to the most recent version of Firefox by going to this link:
    http://www.mozilla.org/en-US/firefox/new/
    My second suggestion is to read this article on how to many your preferences on how Firefox deals with PDFs and all other file types:
    [[Options window - Applications panel]]
    I hope that helps!

  • Unable To Open PDF File In Browser

         I am unable to open a PDF file within my browser using Adobe Reader.  Whenever I attempt to open a PDF file, I get the following message:
    The Adobe Acrobat/Reader selected for viewing PDF documents in browsers cannot be found at its installed location, it may have been moved or deleted.
    Please reinstall or repair the application (15:524)
         I have ensured that Adobe Reader is set as my default program for opening PDF files, and have downloaded and installed the latest version of Adobe Reader.  I am running Windows 8 and Internet Explorer 10.
         I have attempted to contact Adobe Reader Support and was informed that the expected wait time was 3-5 minutes.  I have been holding for over an hour without any support.

    How about if you right click on the PDF and select Save Link As..., and then open it locally from within Reader? Does it work ok then?  That might be a workaround until the issue within the browser is resolved.
    Rob Jaworski
    Intl Program Manager

  • How to open PDF files in Safari

    How does one open PDF files when using Safari

    Typically, you click on a link to a pdf file, and they open. If for some reason that's not working, you can right click on the link and download the file, then it should open in Preview, or Adobe Reader if you've installed that.
    What exactly are you trying to open, and what's happening when you try it?

  • I can't open pdf files in browser, even though I have installed an add-on.

    I downloaded the cloud viewer add-on for Firefox on my tablet. I am running Android 4 (ICS). I need to be able to open PDF files directly in the browser window, as the site will not allow me to download the files and open in an independant viewer. Is there any way to do this in Firefox?

    I find it odd that the browsers on the Android platform can't support this on their own. I know that Google Chrome on it's full blown version for the PC is able to do so without using the Adobe software for the embedded PDF aka using "The Adobe PDF Link Helper" . I would love to see this change especially since I prefer Firefox over other browsers.

  • How to Open PDF in the browser...JSF

    String strUrl = http://..../xxxxxe43cb072378947fe8c1b7bcc7201691a.pdf
    FacesContext faces = FacesContext.getCurrentInstance();
    ExternalContext context = faces.getExternalContext();
    HttpServletResponse response = (HttpServletResponse)context.getResponse();
    response.sendRedirect(strURl);          Hello,
    I have to open PDF in the browser, I am trying to redirect using the above code, but it is throwing exception as below. Could some one help me in this issue?
    Thanks In advance
    Error Message:
    java.lang.IllegalStateException: Cannot forward after response has been committed
    Error details:
    java.lang.IllegalStateException: Cannot forward after response has been committed
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:313)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
         at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
         at com.esri.adf.web.faces.application.ADFViewHandler.renderView(Unknown Source)
         at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at com.esri.adf.web.util.ADFSessionTimeoutFilter.doFilter(Unknown Source)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Unknown Source)

    You cannot send two responses per request. The solution is to let the client create two requests. Common approach is to add an onclick to the commandbutton/commandlink which opens the PDF in a new browser window and let the actual command action invoke a redirect on the current browser window.
    E.g.<h:commandLink value="Download PDF" action="#{myBean.action}" onclick="window.open('http://..../xxxxxe43cb072378947fe8c1b7bcc7201691a.pdf');" />where the #{myBean.action} invokes a redirect and the http://..../xxxxxe43cb072378947fe8c1b7bcc7201691a.pdf opens the PDF in the new window.
    Edit
    I've read your question/problem once more and now I am a bit confused. All you want to do is to open the PDF file in a new window and you don't need to do something in the backing bean? Just use a link with target="_blank".
    <h:outputLink value="http://..../xxxxxe43cb072378947fe8c1b7bcc7201691a.pdf" target="_blank">Download PDF</h:outputLink>No need for a redirect here.
    Edited by: BalusC on Nov 21, 2007 7:21 AM

  • Open PDF file in linux using java

    Hi..
    How can I open a PDF file in linux using java.
    I am able to open PDF in windows and mac using this code
    in Windows
    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + path_of_PDF);
    in mac
    Runtime.getRuntime().exec("open " + path_of_PDF);
    But nothing is working with linux.
    Please help
    Thanks

    appi wrote:
    Hi.. I found the JDIC binary files. There are different binaries for all the plateform. Is there any solution which is independent of plateform.Yes, and we already told you: Use JDK6, which has those libraries built into the standard class library.
    How can I use these binaries in my existing project. does it work, If I place them at same place where other .class files are kept.Read the documentation of the JDIC project. I'm sure they answer this question in their FAQ.

  • How to Open PDF Files Embedded in an Excel File

    This is a solution for Mac users who need to open .PDF files that are embedded inside an Excel file created in Office for Windows.
    I hope this solution works for other file format combinations. I am doing some experimentation to find out and will repost if I have new learnings.
    Problem:
    - Colleague sends me a .XLS which has an embedded .PDF on one sheet
    - Office: Mac 2011 will not open the .PDF because of lack of OLE support
    Solution:
    - Copy the .XLS file to a new file
    - Rename the file from <filename.xls> to <filename.zip>
    - Open the .ZIP with Archive Utility
    - Browse into the resulting "decompressed" folder to filename > xl > embeddings
    - Find the file of interest, named something like <oleObject2.bin>
    - Rename to <oleObject.pdf>
    VOILA!
    The PDF is recovered in its fully glory.

    Hi Ram,
    Following information might help you to resolve the issue.
    After logging into Desktop Intelligence, you may be presented with a message stating:
    u201CYou have received 1 document from users"
    Examining the Inbox from within the Desktop Intelligence client shows no objects visible in your Inbox.
    The object in your Inbox is in a format other than Desktop Intelligence format such as, PDF, XLS or other format. Therefore the object is not recognized by the Desktop Intelligence client inbox browser.
    Log in to Info View or the Central Management Console, browse to your Inbox and verify the file name and format that has been sent to your Inbox. The object may be saved, copied, moved or deleted as necessary.
    Regards,
    Sarbhjeet Kaur

  • How to open epub file in iBooks using ANE(iOS) ?

    hello,
    I tried to open epub file in iBooks using Native Extensions.
    But, AIR app has crashed when calling ANE method (following: OpenEpub).
    Have problems with how to access the epub file?
    Or another problem?
    MacOS:10.6.8
    Xcode:4.2
    FlashBulder:4.6
    FlexSDK:4.6.0(default bundle version)
    TestDevice:1st iPad (OS 5.0.1)
    iOSNativeCode(this code works on native iOS app):
    #import <UIKit/UIKit.h>
    FREObject OpenEpub(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[]){
        id delegate = [[UIApplication sharedApplication] delegate];
        UIWindow* window = [delegate window];
        UIButton* uiBtn = [[[UIButton alloc] init] retain];
        [window addSubview:uiBtn];
        NSString *fileToOpen = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"epub"];
        NSURL *url = [NSURL fileURLWithPath:fileToOpen];
        UIDocumentInteractionController *docController = [UIDocumentInteractionController interactionControllerWithURL:url];
        [docController presentOpenInMenuFromRect:CGRectZero inView:uiBtn animated:true];
        [docController retain];
         const char *str = "Success";
         FREObject retStr;
         FRENewObjectFromUTF8(strlen(str)+1, (const uint8_t *)str, &retStr);
         return retStr;
    ANE packaging directory:
    ane/
         extension.xml
         key.p12
         platform/
              iOS/
                   iOSNativeCode.a
                   library.swf
                   test.epub
    extension.xml
    <extension xmlns="http://ns.adobe.com/air/extension/3.1">
    ~~~~
    Thanks!

    hi, i can open epub in iBooks using ANE !
        UIWindow *keyWindow= [[UIApplication sharedApplication] keyWindow];
        UIViewController *mainController = [keyWindow rootViewController];
        NSString *epubFileName= [[NSBundle mainBundle] pathForResource:@"test01" ofType:@"epub"];
        [epubFileName retain];
        NSURL *url = [NSURL fileURLWithPath:epubFileName];
        [url retain];
        UIDocumentInteractionController *docController = [UIDocumentInteractionController interactionControllerWithURL:url];
        [docController retain];
        CGRect rectDocC = CGRectMake(800, 0, 0, 0);
        [docController presentOptionsMenuFromRect:rectDocC inView:mainController.view animated:YES];
    thanks!

  • Can't open pdf file on browser explorer 11

    I have a problem on one of our customers pc's. it can't open pdf files on explorer browser.
    another user has the same problem, so all the solutions must be other then u can see here: Reader XI PDF Reader Display in browser does not work
    thanks
    shay

    Hi Shay,
    What is your Reader version?
    To check Reader version launch Reader and go to Help->About Adobe Reader
    Thanks,
    Rohit

  • How do open PDF file with Adobe Reader?

    I failed to open PDF file with Adobe Reader? Please show how to fix it.

    Mac or Win? OS and Reader versions? Where is the file and how did you try to open it? What happened when you tried? Any error messages? Details, please.

  • I cannot open pdf files with Firefox using a Mac 10.5.8 OSX

    The new version of Firefox does not support opening pdf files using a Mac 1.5.8 OSX with an Intel processor. Anything I can do?

    ios 6 requires itunes 10.6.3 or higher which requires Mac OS 10.6.8 or higher

Maybe you are looking for

  • SSO EP 6.0 and ITS

    Hello, I try to establish a single sign on connection from our portal to an its instance. The portal version is 6.0 SP2 PL31 The ITS is 6.20 PL 17 My problem is that when I call a certain transaction via the ITS URL I always get the logon screen... W

  • Display an attachment from jsp

    Hello, I store my web application attachments under ROOT folder and my problem is that I can access to them also if I write directly the appropiate url in the browser without entering in the application... How should I do to access to files only thro

  • Help me for EJB

    Hi, I'm trying to run a ejb example downloaded from http://java.sun.com/javaee/5/docs/tutorial/information/download.html this link. And when try to build the app its showing some error that javax.ejb doesnt exist.What would i do? I am a beginner plea

  • Bound Search helps

    hi, i have two search helps and 2.search help is not enabled, because it will be enable when user choose a value from the first search help. Normally they are bound together but in WDA i can't do it. for example : 1.search help : A --> 2.search help

  • New to oracle database

    Hi All, I just joined in this forums. I am working on SQL server and have just one year experiance in IT. Intrested to move to Oracle database. I want to do some certification in oracle database for developer role. I am not able to choose from certif