How to display PDF in JSP using Iframe

Hi All,
I am using Struts 2. I am building my file in ActionClass with seperate Method like getGeneratedPDF() in which, I am setting header of response and writing into PDF.
This method will be called from JSP by this way
s:property value="getGeneratedPDF()" />
But It displayed Junk Characters , and this PDF is not static (already Generated). It is generated and build on Fly.
I have 2 questions 1 -- How to display PDF in JSP in proper way without Junk Character in it?
questions 2 -- How to display it in Iframe?
Please help me , If you know the solution.
Thanks in Advance,
Jimmy

jamy_26 wrote:
But It displayed Junk Characters , and this PDF is not static (already Generated). It is generated and build on Fly.A PDF file is a binary file, not a text file, and you're trying to display it as String. Of course you would get "junk characters". Have you ever tried opening a binary file (pdf, doc, jpg, xls, etc) using a text editor like Notepad?
I have 2 questions 1 -- How to display PDF in JSP in proper way without Junk Character in it?Display it as binary stream, not as text stream. You can display it standalone, just let the link/form/addressbar URL point to some Servlet which writes the InputStream of the PDF file to the OutputStream of the response, along with a correct set of response headers (at least content-type, content-disposition and content-length), so that the browser can open it in the correct application (which is usually Acrobat Reader). If you want to embed the PDF file in a JSP, then one of the ways is indeed using the HTML <iframe> tag.
questions 2 -- How to display it in Iframe? Just let the iframe URL point to the aforementioned Servlet.
You can find here an example of a generic file servlet, you may find it useful to get the idea how to do it: [http://balusc.blogspot.com/2007/07/fileservlet.html].

Similar Messages

  • Display PDF in JSP using a content selector

    Hello,
    We are running on WLP 8.1 sp4. We have documents (Word and PDF) stored in the Weblogic Portal content management system. We have made several tries, but are unsuccessful in rendering a PDF inside a JSP using Content Selector tags. We can get a link to display and other properties of the content type, but we have not been able to show the actual binary property of the PDF. Has anyone climbed this mountain before, any help will be greatly appreciated!
    Rob
    The following displays links to the documents, but not the actual document.
    <pz:contentSelector rule="novel_flu_db_archived_reports"
    id="fluArchiveQuery" />
    <utility:notNull item="<%=fluArchiveQuery%>">
    <utility:forEachInArray array="<%=fluArchiveQuery%>" id="docA" >
    <cm:getProperty id="docA" name="file" conversionType="html" />
    <ad:render id="docA" />
    </utility:forEachInArray>
    </utility:notNull>

    Thank you for the response.
    Option 1 - would be great, but I am having problems getting this to work (see thread "Problem accessing a file stored in the CMS from link on JSP")
    Option 2 - I need to look into, as we need to be compliant with Accessibility standards and I can't remember if IFrames pose any problems for screen readers.
    Option 3 - introduces an additional step to the work flow, we would like to avoid extra work (if possible)
    In looking through the archives, there was mention of a "stand alone" JSP which was not under a Portlet or the Portal. The PDF was displayed in the stand alone JSP where the mime type was altered to PDF. Would this be an option?
    -Rob

  • How to display pdf in Web Dynpro Page

    Hi Experts,
    I need to display the pdf file in web dynpro page. I am using  Web dynpro 7.1(CE), in that no ui element like Iframe. With Iframe we can display the pdf file in web Dynpro page in 7.0.
    But My problem is how display pdf with out using Iframe.
    Please any one tell how to display with any other UI elements.
    Regards,
    Sunil.

    Hi sunil..
    chk this link..
    <u><b>Pdf</b></u>
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0401535-f81c-2a10-0192-ffd41e8e8d59
    <u><b>Adobe</b></u>
    /people/achim.hauck/blog/2005/02/04/my-struggles-with-the-adobe-document-services-in-was640
    <u><b>Configuration</b></u>
    http://help.sap.com/saphelp_nw70/helpdata/en/43/8a1a8ece230c8ce10000000a11466f/content.htm
    <u><b>Adobe Document services</b></u>
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9e4e9afb-0701-0010-f8a8-b8cd093662c2
    <u><b>Configuring Guided procedure of Interactive Forms</b></u>
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b9ea34c2-0701-0010-e2a2-d8e9cd6d85dc
    <u><b>Forum Discussions abt Adobe Document Services</b></u>
    Re: Configuring the Destination URL for the Adobe Document Services
    Hop will this helpful for u..
    Regards,
    GS

  • How to display Pdf file in iPad site

    Hi
    How to display Pdf file in web page which can able to view in iPad safari?
    Thanks,
    Arun

    You can't really.
    You need to use DHTML in the swf-wrapper HTML file, usually a
    division wrapped iFrame, and load the PDF into the iFrame as an
    overlay to the Flash.

  • Trouble Setting "Display PDF in browser using" by MCX

    I want to force the PDF viewer in Safari to Mac OS X v10.6 built-in Preview Application instead of Adobe Acrobat Pro (9.4.0).
    I found that unchecking "Display PDF in browser using:" in Acrobat's Preferences, sets the viewer in Safari to Preview. It seems unchecking this box modifies ~/Library/Preferences/com.adobe.Acrobat.Pro_x86_9.0.plist. by creating the entry root => Originals (dictionary) => BrowserIntegration (array) => item 0 as number with value 0, item 1 as boolean with value 0.
    With that in mind I tried creating a MCX setting in my OD to apply root => Originals (dictionary) => BrowserIntegration (array) => item 0 as number with value 0, item 1 as boolean with value 0. Witch resulted in a grayed out, but checked settings for  "Display PDF in browser using:"
    I was wondering if any one has successfully figured out how to set this setting?

    Hi,
    Firstly during the installation of Reader X, there is an option of Customize Install. You can uncheck the Safari browser plugin from there. But this was possible before install. Now since you have installed in default mode (with above option checked during install) the method to disable plugin is as follows:
    To disable the plugin-
    1. Go to Library > Internet Plug-Ins
    2. You will see AdobePDFViewer.plugin in the list of plugins
    3. Create a new folder called Disabled Plug-Ins
    4. Move the AdobePDFViewer plugin into the Disabled Plug-Ins folder
    5. Restart  Safari
    In future if you want to re-enable this then you can put this plugin back to its original location or Reinstall Reader X (if you have permanently deleted the plug-in from your system). Reinstallation works as installing in repair mode.
    AcrobatX/ReaderX uses MANAGED installation method on Mac(as compared to MANUAL installation method used in earlier versions). In case of manual installation method installation and repair was dependent on "Self heal" mechanism that required the admin privileges each time it was invoked. This raised a bit of concern so to remove this Adobe now uses Managed installation method and discontinued Self Heal mechanism.
    You can check out this link for more information or if you want to track this discussion -
    http://acrobatusers.com/forum/deployment-installation/acrobat-x-installation-installed-saf ari-plugin-without-asking
    Thanks,
    Karan

  • Display date in jsp. using struts, JSTL

    want to display today's date in format October 18, 2006
    how to get today's date and how to display it in jsp?
    I am using struts framwork and JSTL tags in my JSP.
    Thanks.

    rizza_99 wrote:
    The page underlines {<fmt:formatDate value="${now}" type="both" dateStyle="long" />} says
    attributte value doesn't accept any expressionsWait, you said "the page underlines"?? So you're using an IDE? Are you sure that it a JSTL problem and not an IDE problem? Ignore the IDE and just execute the code. Does it work without any compilation errors or runtime exceptions? If so, then there's a problem in the IDE.

  • How to display items from database using catagorylookupdroplet

    Hi everyone,
    i want to know how to display items from database using catagorylookup droplet. if anybody have any code snippet please share it.
    Thanks in advance,

    <dsp:droplet name=".................../CategoryLookup">
         <dsp:param name="id" param="itemId"/>
         <dsp:oparam name="output">
              <dsp:valueof param="element.displayName"/>
                   <%-- This is show the Child Category --%>
                   <dsp:droplet name="......................./ForEach">
                   <dsp:param name="array" param="element.childCategories"/>
                   <dsp:oparam name="outputStart">Child Categories</dsp:oparam>
                   <dsp:oparam name="output">
                        <dsp:a href="">//bydefault it will take its own file's name
                             <dsp:param name="itemId" param="element.repositoryId"/>                                                                                          <dsp:valueof param="element.displayName"/>
                        </dsp:a>
                   </dsp:oparam>                                             
                   </dsp:droplet>
                   <%-- This is show the Child Product --%>          
                   <dsp:droplet name=".............../ForEach">
                        <dsp:param name="array" param="element.childProducts"/>
                        <dsp:oparam name="outputStart">Child Products</dsp:oparam>
                                  <dsp:oparam name="output">
                                       <dsp:droplet name="................/ProductLookup">
                                            <dsp:param name="id" param="itemId"/>
                                            <dsp:param name="elementName" value="Prod"/>
                                            <dsp:oparam name="output">
                                                 <dsp:getvalueof id="img102" param="Prod.smallImage.url" idtype="java.lang.String">
                                                      <dsp:img height="250" width="250" src="<%=img102%>"/>
                                                 </dsp:getvalueof>
                                            </dsp:oparam>
                                       </dsp:droplet>
                                       <dsp:a href="productView.jsp">
                                            <dsp:param name="itemId" param="element.repositoryId"/>
                                            <dsp:valueof param="element.displayName"/>
                                       </dsp:a>
    Hope this helps.
    -RMishra

  • Can't uncheck 'display PDF in browser using' on mac

    Reader 10.0.0
    'display PDF in browser using' in the Internet preferences is stuck on to Adobe Reader. The checkbox is checked/disabled, and cannot be unchecked.
    Also, viewing a PDF in the browser via FTP sticks the entire browser (hence my reason for noticing/disabling this plugin)
    Had to remove the plugin file from file:///Library/Internet%20Plug-Ins/ to remove.

    Hi,
    Firstly during the installation of Reader X, there is an option of Customize Install. You can uncheck the Safari browser plugin from there. But this was possible before install. Now since you have installed in default mode (with above option checked during install) the method to disable plugin is as follows:
    To disable the plugin-
    1. Go to Library > Internet Plug-Ins
    2. You will see AdobePDFViewer.plugin in the list of plugins
    3. Create a new folder called Disabled Plug-Ins
    4. Move the AdobePDFViewer plugin into the Disabled Plug-Ins folder
    5. Restart  Safari
    In future if you want to re-enable this then you can put this plugin back to its original location or Reinstall Reader X (if you have permanently deleted the plug-in from your system). Reinstallation works as installing in repair mode.
    AcrobatX/ReaderX uses MANAGED installation method on Mac(as compared to MANUAL installation method used in earlier versions). In case of manual installation method installation and repair was dependent on "Self heal" mechanism that required the admin privileges each time it was invoked. This raised a bit of concern so to remove this Adobe now uses Managed installation method and discontinued Self Heal mechanism.
    You can check out this link for more information or if you want to track this discussion -
    http://acrobatusers.com/forum/deployment-installation/acrobat-x-installation-installed-saf ari-plugin-without-asking
    Thanks,
    Karan

  • How to do  validation in jsp using javascript

    how to do validation in jsp using javascript

    The same way you do with any HTML page.
    Catch the onclick/onsubmit event, do your validation in javascript and then allow/cancel the action as required.
    However this is javascript validation only - javascript can never call JSP code.

  • How to display all the surveys using content query web part

    Can you please tell me how to display all the surveys using content query web part in more details? I also created a subsite and multiple surveys in that site. Then, I inserted a Content Query Web Part and select the List Type to be "Survey",
    however, it returned nothing. Did I miss anything?

    Hi,
    OOTB Survey List does not contain any
    Content Types and it has the following structure:
    Response entry is represented by
    List Item
    Response entry consist of questions and answers, where Question correspond to
    Field and Answer to Item value respectively.
    For querying Survey List via CQWP  the following properties could be used
    BaseType 
    <Lists BaseType="4">
    ServerTemplate
    <Lists ServerTemplate="102">
    Example
    To retrieve all the responses from Survey lists, specify List Type property as shown on picture
    Reference:
    http://stackoverflow.com/questions/17280778/display-all-surveys-using-content-query-web-part
    Best Regards,
    Eric
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to display smartforms table lines useing different background colour

    Hi all:
    How to display smartforms table lines useing different background colour .
    for example:
    line1:green
    line2:red
    line3:green
    line4:red
    line5:green
    line6:red
    line7:green
    line8:red
    Any help is highly appreciated!!
    启明星

    Hi,
    Create a two lines one for header and second for data in the table.
    1)In table painter we can find the pencil mark.
    2)select the pencil mark
    3)now select the line which you need to shade
    4) now select the shading colour in the table painter and the provide the resolution up to 100% and select table pattrn for that line.
    5) Now you can use this for the header now only the header gets shaded and the remaining gets unshaded.
    reward points if useful
    Thanks and Regards,
    Nishant

  • How to display another window by using Check box

    Hi Friends,
    I have one doubt in Webdynpro with java. How to display another window by using Check box?
    For Exam My requirement is I am getting BAPI from ECC System. So I have to go given input details in first view and output details in Second View. So in Second View I will taken Table that data will displayed in rows. each and every row first check box is available.
    Here Select Check Box of particular row then click Edit button. That row data will be displayed in one popup window.
    empid, name, sal ,firstname, last Name
    empid, name, sal ,firstname, last Name
    empid, name, sal ,firstname, last Name
    Suppose I have to select check box in First Row Click on EDIT button That row data will be displayed in another popup window here customer will change details depending up requirement click on SAVE Button that update data will saved in ECC System.
    How to display another window by using Check box?
    Regards
    Vijay

    Hi Vijay
    Your question is not clear enough to give an answer. Do you have some difficulties with the code for opening a popup-window? There are many-many examples in the forum how to open/close a popup.
    Or you do not know how to bind the popup opening with clicking a check box? Just put the code in the onSelect event handler of the check box.
    BR, Siarhei
    Edited by: Siarhei Pisarenka on Mar 11, 2010 10:55 AM

  • How to display pdf file in windows phone 8 silver light application?

    Hi,
    I am developing windows phone 8 silver light application . For my app I want to display pdf files . Is there any default controls to display pdf files ?
    I don't want to display using launchers , I want to display with in the app.
    any help,
    Thanks..
    Suresh.M

    Probably this should give you a fair idea : How to view PDF file inside an Windows Phone application?
    http://developer.nokia.com/community/wiki/Using_Crypto%2B%2B_library_with_Windows_Phone_8

  • How to display PDF on a page

    Hi,
    I have a pdf document out on intranet site that I would like to have a APex report link to that document.
    This is how I defined the page:
    Page type - URL
    region source - http://www.xxx.xxx/../xxx.pdf
    It took a long time to bring up the pdf and the document is displayed in the wrong format. Has anyone done it before? How can I display pdf in APEX?
    Thanks,
    Julie

    Hello Julie,
    Here is how I handle making my user's reference manual available from my application. It is a PDF stored like yours.
    1. Define item as: Display as Text (excape special characters, does not save state)
    2. Make your Label something like this: &lt;a href="[http://www.mydomain.com/.../.../.../document.pdf] target="_blank"&gt;System User Manual&lt;/a&gt; (substitute your link info of course)
    target="_blank" opens the document in a new window.
    3. Set Horizontal/Vertical Alignment appropriately (I use Left).
    4. Template: Optional Label
    The remaining items do not matter.
    The things now that will dictate how long to download the PDF are, network speed on your end, network speed on the recipient end, network load, size of the PDF and the other normal things that cause a download to be slow.
    Hope this helps,
    Don

  • Preview ppt,word,excel,pdf in flex using iframe

    hi,
    i am working upon flex 4.6 web application.i have a requirement in my project to preview ppt,pdf,word and excel inside flex container. i have achieved previewing only pdf by using flex-iframe 1.5.1, since pdf has browser plugginn. i am just binding the download path what i am getting from the server to the source of my iframe In HTML5 we can preview it using iframe by binding it to google docs viewer. i tried doing the same in flex but for me its showing that because of the security constaints of the owner cannot display it rather open it in another tab.
    kindly suggest me a way to preview ppt,word and excel inside flex container using iframe or if any other better or simple approach is there.
    kindly help... any help would be greatly appreciated.
    heres is my code-
    <mx:VBox id="vbxFrame" width="100%" height="100%" backgroundColor="#FFFFFF" includeIn="pdf" verticalCenter="0" horizontalCenter="0">
    <flexiframe:IFrame id="iframeFlexpdf" backgroundColor="#cccccc" width="100%" height="100%" horizontalCenter="0" verticalCenter="0" source="any url"/>
    </mx:VBox>

    Refer to the LOB Datatype sample.
    http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/advanced/advanced.htm

Maybe you are looking for

  • Internal hyperlinks not working when published

    I published my website made in iweb to my own domain, and the links in the navigation bar I made don't work - they don't even register as hyperlinks. I published to .mac in case this was a data transfer problem, but the same thing happened. When I'm

  • Display is in black and white

    i'm using tiger os and the screen turned black and white i want to switch it to color again how can I fix it? please help please.

  • CST  Split !!

    Hi Experts, I have a requirement to split  CST condition value into 2. As my client gets 96% of CST  remission and only 4% is actually paid to the authorities. So, Client want to post 100% CST into a GL account and later, It has to be posted into 2 d

  • CAD Upgrade from 7.5.8 to 7.6.2

    Hi all, hope everyone is well !! I am running UCCE 7.5.8 with CAD 7.5.8 and I am having an issue with CAD running on Windows 7 where the agent/supervisor desktop sporadically hang or stop responding for a while. I understand CAD 7.5.8 is not supporte

  • Max value

    Hi to All, I have to find out max salary from a table, without using max function... is there any other way to find... thanks and regards MKK