Load PDF file using ADF 11g

Hi There,
I have a requirement of showing PDF file in popup window or in a frame . I am using the following code
<af:commandButton text="#{node}" useWindow="true" action="dialog:showPDF"
actionListener="#{ReportTemplateDesigner.downloadPDFReport}" windowHeight="300" windowWidth="400" />
and in managed bean
public String downloadPDFReport(ActionEvent actionEvent) throws FileNotFoundException, IOException {
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = facesContext.getExternalContext();
HttpServletResponse response =
(HttpServletResponse)externalContext.getResponse();
File file = new File("C:\\report.pdf");
FileInputStream input = new FileInputStream(file);
BufferedInputStream bInput = null;
BufferedOutputStream output = null;
try {
bInput = new BufferedInputStream(input, DEFAULT_BUFFER_SIZE);
response.reset();
response.setContentType("application/pdf");
response.setHeader("Content-disposition",
"inline; filename=\"" + "ABC" + "\"");
output =
new BufferedOutputStream(response.getOutputStream(), DEFAULT_BUFFER_SIZE);
System.out.println("inside download PDF report");
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
int length;
while ((length = input.read(buffer)) > 0) {
output.write(buffer, 0, length);
output.flush();
} finally {
close((Closeable)output);
close((Closeable)bInput);
facesContext.responseComplete();
return "dialog:showPDF";
I can see the pdf file is loaded into the same window . Could anyone tell me is there any way to load PDF file on the same page in a frame ?
Thanks in advance,
Ree

Managed bean code :
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext =
facesContext.getExternalContext();
HttpServletRequest request =
(HttpServletRequest)externalContext.getRequest();
String originalUrl = (request.getRequestURL().toString());
String find = "Report";
String replace = "Report/" + pdfFileName; // path of pdf file .
pdfUrl = replaceAllWords2(originalUrl, find, replace);
System.out.println("PDF URL :" + pdfUrl);
Jsf code
<af:inlineFrame source="#{Report.pdfUrl}"
inlineStyle="width:100%; height:100%;"></af:inlineFrame>
Hope this help.
Reena

Similar Messages

  • Loading jar files using loadjava - 11g Enterprise Edition 11.1.0.6.0-64bit

    Hi,
    We are trying to fetch data from a weblogic server using a JMS thin client.
    We have loaded our client code jar(application.jar) and the following thin client jars in oracle using loadjava.
    (Version:- Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production).
    1) wljmsclient.jar
    2) wlthint3client.jar
    3) wlclient.jar
    some of the classes remain in invalid state after loading the jar files. we validate them manually.
    When we run the client code we are getting following exception.
    ORA-29532: Java call terminated by uncaught Java exception: java.lang.InternalError: error initializing kernel caused by: java.lang.ExceptionInInitializerError
    at weblogic.protocol.ClientEnvironment.loadEnvironment(ClientEnvironment.java:22)
    at weblogic.kernel.Kernel.initialize(Kernel.java:92)
    at weblogic.kernel.Kernel.ensureInitialized(Kernel.java:64)
    at weblogic.rjvm.wls.WLSClientRJVMEnvironment.ensureInitialized(WLSClientRJVMEnvironment.java:55)
    at weblogic.protocol.ServerURL.getDefaultURL(ServerU
    Any help on the above issue?
    Thanks,
    Navin

    Hi;
    For your issue i suggest close your thread here as changing thread status to answered and move it to Forum Home » Database » JVM which is JVM dedicated forum site.
    Regard
    Helios

  • Recently my adobe is taking much longer to load PDF files that used to open immediately

    recently my adobe is taking much longer to load PDF files that used to load almost instantly

    Look at this comprehensive trouble shooting document;
    https://discussions.apple.com/docs/DOC-3353
    I suggest that you start with SMC and PRAM resets.
    Then  a Safe Boot.
    Ciao.

  • Print PDF file using Acrobat SDK - Warning message

    Hello,
    We are trying to create automatic program in c# that will print all pdf files located in a specific folder, using Adobe Acrobat 9.0 SDK.
    Whenever the application tries to print file, we receive a warning message ("WARNING! A script has requested to print an Acrobat file. This could print an entire document. Do you want to proceed printing?").
    If we press yes, the file is printed, but next time we'll run the application, this message will appear again.
    Since this application supposed to run automatically (with no interaction with the end users), we want to prevent this warning message from appearing.
    How can we eliminate this warning message?
    Is there any other way to print PDF files using Adobe Acrobat from another application?
    Thanks,
    Lilach.

    joeln3:  I believe the original post refers to a client application, not a web page.  Why use JavaScript from within a client application?  I understood their use case to involve a client app referencing the PDF Library, loading various PDF files, and using one (or more) of the PDF Library's Print methods to invoke Acrobat's internal print routines.
    Dave

  • Can't view PDF files using Acrobat Reader X

    We made many PDF files available on our Web site. In the past few weeks we noticed that users who were using Acrobat Reader X and Internet Explorer 8 or 9 were not able to view some PDF files. Basically, when they clicked a link to display a PDF file, the screen would be cleared and the status bar showing "Loading ...KB/...K/B" would be displayed. The status bar would move a bit and then got stuck. The PDF file would never be displayed. Sometimes, my users could click the Back button to go back the previous Web page and sometimes they had to close or kill the IE window. Small PDF files seemed to be fine. I was able to repeat this problem on PCs running Windows XP and Windows 7. I also tested clicking the same PDF files with PCs installed with Acrobat Reader 9 and I was not able to cause the problem to occur, so I am pretty sure that this problem is related to Acrobat Reader X. I also noticed that if I unchecked the "Display PDF in browser"  option in Acrobat Reader X so that PDF files would not be displayed inside the Internet Explorer window, I would be able to view all PDF files without any problems.
    I also did an experiment by resaving many PDF files using Acrobat Pro (Reduce File Size...) to be compatible with Acrobat 8 or above. I was able to open these PDF files using Acrobat Reader X but when I used a PC with Acrobat 9, it would get stuck instead. Most of my PDF files were created a long time ago and we usually made it compatible with Acrobat 5 or above.
    I saw that some people reported some problems with Acrobat Reader X but I did not see a solution except uninstalling Acrobat Reader X and installing an old version of Acrobat Reader instead. Anyone has any ideas why this is happening and how to fix this problem?
    RJ

    Sounds like you got the trial of Acrobat. Go to add/remove programs, get rid of it, the download the free Reader from http://get.adobe.com/reader/

  • Loading pdf file in flex application (not in AIR)

    Hi,
    Could any one suggest opening pdf file within flex application with blazeds.
    we have used the following code to open pdf file in the same window
    navigateToURL( new URLRequest( "http://localhost:8080/PdfSample/jsp/PdfContent.jsp" ),"_self");
    But we want to load the pdf file in a vbox.Similary to the below image
    Is it is possible to load pdf file in flex application,if so how can we achieve it

    Hello Mariush,
    I have to display the content of the PDF in the flex application. If not PDF directly, is there other workaround for this. Or can I display the content of the MS word file, if not PDF.
    Thanks and Regards
       Khalid Chaudhary

  • Ebook reader that loads pdf files

    currently just using the adobe reader to read pdf files.
    is there a decent app/ereader that will load pdf files that ive downloaded, possibly with a bookmark facility?
    thanks

    Hello lauramc7, 
    Thank you for your question. 
    You may want to look at installing PDF To Go®. Have a look at this article for more information. 
    KB23377
    How to install PDF To Go 2.0 for BlackBerry smartph
    Hope this helps. Have a good day. 
    -SR
    Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)!

  • Programatically scroll a loaded pdf file

    I was wondering how can I programatically scroll a loaded pdf file? I would be so thankful of any working reply.

    Do you want it to scroll in the Adobe Reader program or as a part of the VI?  In the Adobe Reader option, it would depend on if Adobe has ActiveX support.  If so you can access ActiveX in LabVIEW .  However there is no inherent way to manipulate PDFs in LabVIEW other than using this method.
    David_L | Certified LabVIEW Architect
    LabVIEW Tools Network | LabVIEW Tools Network Developer Center

  • Does anyone know how i can view PDF files using Galaxy Note 2?

    Does anyone know how i can view PDF files using Galaxy Note 2?
    This is what i have been doing;
    I click on the file i wish to view (via a portal)
    this file goes to notification widget (i drag down screen)
    notification/message says download complete
    i click on notification/message
    nows it says complete action using (here i only have 2 icon options 1= DB Text Editor 2 = HTML Viewer)
    I have installed Adobe Reader.

    Can you confirm if the downloaded file is a pdf file, that is it ends with .pdf?

  • How to extract text from a PDF file using php?

    How to extract text from a PDF file using php?
    thanks
    fabio

    > Do you know of any other way this can be done?
    There are many ways. But this out of scope of this forum. You can try this forum: http://forum.planetpdf.com/

  • How to read pdf files using java.io package classes

    Dear All,
    I have a certain requirement that i should read and write PDF files at runtime. With normal java file IO reading is not working. Can any one suggest me how to proceed probably with sample code block
    Thanks in advance.

    hi I also have the pbm. to read pdf file using JAVA
    can any body help meWhy is it so difficult to read the thread you posted in? They say: java.io is pointless, use iText. So why don't you?
    or also I want to read a binary encoded data into
    ascii,
    can anybody give me a hint how to do it.Depends on what you mean with "binary encoding". ASCII's binary encoding, too, basically.

  • How do I open to a specific page or destination in a pdf file using Buddy API Xtra?

    Hello,
    I'm working with a CD ROM catalog that utilizes the Buddy API Xtra to open PDF files when a link is clicked. The client would like to be able to open to a specific page within a pdf file.
    I can open a pdf file using the Buddy API baOpenfile() function but I'm having trouble opening to a specific page when I add #page=4:
    baOpenfile("@\pdfs\Powder Cores\Magnetics_Powder_Core_Catalog_2011.pdf#page=4","normal")
    I've also tried working with the code below which seems to me like it should work... I didn't realize that the "open..." part of it was a function in Director.
    on mouseUp me
      pageNum = 4
      theApp = baShortFileName(baFindApp("pdf"))
      theDoc = baShortFileName("@\pdfs\Powder Cores\Magnetics_Powder_Core_Catalog_2011.pdf")
      theArgs = "/s /A page=" & string(pageNum)   & "&pagemode=bookmarks"
      -- (translates to "/A page=4" in this example)
      open theApp && theArgs && theDoc
    end
    Thoughts?
    Thank you in advance!

    Thank you Dee! This works perfect!
    It would be cool to know how to use bashell() for this.
    The help files give the following examples:
    Result = baShell( Operation, Filename, Args, WorkDir, State )
    ok = baShell( "open", "c:\windows\notepad.exe", "myfile.txt" , "", "normal" )
    ok = baShell( "edit", "myfile.htm" , "", "", "normal" )
    So I tried:
    on mouseUp me
      -- Close the program group
      tWindowList = baWindowList( "" , "pdf" , false )
      if tWindowList <> [] and count(tWindowList) > 0 then  baCloseWindow(tWindowList[1])
      pageNum = 4
      theApp = baFindApp("pdf")
      theDoc = _movie.path & "pdfs\Powder Cores\Magentics Powder Core Catalog.pdf"
      theArgs = "/A "&QUOTE&"page="&string(pageNum)&"=OpenActions"&QUOTE
      baShell( "open", theApp, theDoc , theArgs, "normal" )
    end
    It opens the pdf file without going to a specific page. Any thoughts as to why it wouldn't accept theArgs?
    Thanks again!

  • Load multiple files using the same data load location

    has anybody tried loading multiple files using the same load locations. I need to do this as the data in these multiple files will need to be exported from FDM as a single export file. the problem i am facing is more user related. since these files will be received at different points of time, users will need a way to tell them what has been loaded and what is yet to be loaded.
    is it possible to throw a window on the web broser with OK and Cancel buttons from an event script?
    any pointers to possible solutions will be helpful

    was able to resolve this. the implementation method is as follows
    take a back up of previously imported data in the befcleardata event script. then in the beffileimport event append the data to the import file. there are many other intricacies but this is the broad implementation logic. it allowed my users to load multiple files without worrying about append or replace import type choices

  • How to check the resolution of a pdf file using Acrobat 9 pro?

    How to check the resolution of a pdf file using Acrobat 9 pro?

    PDF files don't have one resolution, but may have none or many different resolutions, one per image. You can check the maximum/minimum resoluion with preflight in Acrobat Pro, but not in Adobe Reader.

  • Laserjet p2055dn is slow printing pdf files using mac

    My Mac is very slow printing pdf files on my hp laserjet p2055dn.  I have noticed fixes for this problem for people using Windows.  Is there a Mac solution?

    Do you want to create PDF files using Java? If so, there is a library available at http://www.lowagie.com/iText/docs.html Check out this site. There are many more similar PDFGEnerator tools that you can use..

Maybe you are looking for