Embed PDF in a Flex Application

Hi All,
I am trying to embed a PDF Document in a Flex Container, but
I think it is impossible.. Some people talks about iframes, but it
is not a nice workarround at all.
I have read that in Adobe Air it is possible to do that.
¿Why in Adobe Air and not in Adobe Flex?
Has anyone been in trouble with this and has a solution?
Thanks in advance,
toni

Here is a work around if you can call a JSP page:
Flex code:
var jspLink:URLRequest = new
URLRequest("jsp/downloadpdf.jsp?fileName=Fundraiser_flyer_2008.pdf");
navigateToURL( jspLink, "_blank" );
JSP Page 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

  • 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

  • Displaying PDF file in Flex application

    Hello,
    Is there any way, by which I can read/display PDF file as it is in Flex application (Web based). Is there any way or work around by which I can achieve
    this.
    Awaiting for prompt response.
    Thanks and Regards

    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

  • Haw disable the saved icon of pdf document inside flex application??

    Hello,
    My gool is to disable the save icon of pdf document when i open the pdf document inside flex application.
    Haw you any ideas?
    Thanks you

    This isn't something that can be managed from the Flex end of things. You have to configure the document DRM.

  • How to display pdf file in flex application

    hi,
    I am Ibran, I am using Flex4.5, in that i want to display a pdf file like images.
    How can i do it please anyone tell me.
    I have used navigateToURL(url),but this was going into navigation and i can't see my textfield and buttons.
    So without this  navigateToURL(url) how can i display a pdf file in flex without navigation so that i can see my textInputs and buttons.

    Flash does not have the ability to load/display/manipulate PDF files, so you can't open it directly in the flex application.  With clever HTML and javascript, you can make it appear that it is in the same window, but it will actually be in a separate window/div in the browser.  And yes, this has always seemed absurd to me that Adobe doesn't support PDF's......
    Mark

  • Hi. Is it possible to load/view a pdf file in Flex application?

    Hi,
    Can we load a pdf inside a flex web application (not AIR)? If yes, how to we interact with the loaded pdf using javascript?
    Appreciate your help.
    Thanks
    Mahesh

    No, you can't directly load a pdf inside a flex web application.  You can use the external interface to open one in either an iframe, or a new tab/window in the browser.  Then you can use external interface calls (javascript calls to the host browser) to interact with the loaded pdf.
    Mark

  • How to embed Passcode mechanism in flex application

    Hi,
    I'm developing a flex based application. Almost everything is done. Now I would like to let the users to install this product only for 3 times on their machine.
    For this, Passcode mechanism is a good idea. The user has to enter this passcode which went alongwith the CD / DVD product after installing the product.
    They shall use this code for only 3 times. After that the product should not accept this passcode. Could anyone suggest me how to accomplish this task in flex ?
    Any tutorials for this ?
    Thanks in advance.

    The AIR desktop application is already made. The user will have to purchase the CD to install it. He/She should have to input the Code which went along with the CD while installing the product.
    He / She should be able to use this CD only for 3 times in the same computer OR use this CD in 3 different computers for 1 time in each.
    Simply it should be used only for 3 times.
    Could anyone suggest me how to accomplish this task ?

  • PDF inside FLEX APPLICATION?

    My goal is to open a document pdf in a flex application.
    My document pdf is generated by using the library itext and an action struts.I used flex-iframe but the iframe source receives a path fixed like "http://localhot:9090:/applicationTest/exemple.pdf".
    have you any ideas?
    This is the exeample of  index.mxml when I use flex -iframe with a fixed path of pdf document
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                    xmlns:local="*"
                    creationComplete="init();"
                    viewSourceURL="srcview/index.html">
        <mx:Script>
            <![CDATA[
                private function init():void
                    iFrame.visible=true;
            ]]>
        </mx:Script>
        <mx:HBox width="100%" height="100%">
            <mx:Panel width="100%" height="100%" title="Test PDF" paddingTop="1" paddingBottom="1" paddingLeft="1" paddingRight="1" >
                <local:IFrame id="iFrame" source="http://localhot:9090:/applicationTest/exemple.pdf" width="100%" height="100%" />
                <mx:ControlBar>
                    <mx:CheckBox id="cbVisible" label="IFrame Visible" selected="true" click="iFrame.visible=cbVisible.selected"/>
                    </mx:ControlBar>
            </mx:Panel>
        </mx:HBox>
    </mx:Application>
    This is the example of code that is failed:--> the pdf document is opened in the other window of browser:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                     xmlns:local="*"
                     creationComplete="init();"
                     viewSourceURL="srcview/index.html">
        <mx:Script>
             <![CDATA[
                 private function init():void
                     iFrame.visible=true;
             ]]>
         </mx:Script>
         <mx:HBox width="100%" height="100%">
            <mx:Panel width="100%" height="100%" title="Test PDF" paddingTop="1" paddingBottom="1" paddingLeft="1" paddingRight="1" >
                 <local:IFrame id="iFrame" source="http://localhost:9090/ApplicationTest/gi/printAction.do?method=printConfirmation&id=OTY" width="100%" height="100%" />
                 <mx:ControlBar>
                     <mx:CheckBox id="cbVisible" label="IFrame Visible" selected="true" click="iFrame.visible=cbVisible.selected"/>
                     </mx:ControlBar>
             </mx:Panel>
        </mx:HBox>
    </mx:Application>
    this is the action that generate the pdf document : "http://localhost:9090/ApplicationTest/gi/printAction.do?method=printConfirmation&id=OTY"
    Thanks

    Hello,
    Maybe you can use NavigateToURL like:
    navigateToURL( new URLRequest( 'example.pdf), '_new' )"
    http://livedocs.adobe.com/flex/3/langref/flash/net/package.html
    http://livedocs.adobe.com/flex/3/langref/flash/net/URLRequest.html
    Regards
    Johnny

  • Flex application embedded in a PDF performing a LC call

    Hi,
    I have a Flex application that is embedded in a PDF as a navigator which is supposed to invoke LiveCycle application deployed on a weblogic server using SOAP endpoint. The web service call seems to work fine if I run it from Flash Builder but once it’s inside a PDF, it would appear that the web service call is not reaching the application deployed on the Document Service server. The same application, however, does work if the server is deployed on JBoss.
    I was wondering if anyone has suggestions on how I should go about troubleshooting.
    Thanks, Lilliam.

    Hi,
    Creating a new project it's
    - File -> New -> Flex Project
    - Application Type -> Desktop
    Setting this will create the descriptor file and create the WindowedApplication as the root. This application will startup in a native os window.
    Here is an example of creating a simple os child window;
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                           xmlns:s="library://ns.adobe.com/flex/spark"
                           xmlns:mx="library://ns.adobe.com/flex/mx">
        <fx:Script>
            <![CDATA[
                import spark.components.Window;
                protected function button_clickHandler(event:MouseEvent):void
                    var window:Window = new Window();
                    window.title = "Hello Window";
                    window.width = 200;
                    window.height = 200;
                    window.open();
            ]]>
        </fx:Script>
        <s:Button label="Open Window"
                  click="button_clickHandler(event)"/>
    </s:WindowedApplication>
    The documentation will guide you the rest of the way.
    Mike

  • Best practice to embed flex application in html

    Hello guys
       I am not sure what's the best practice to embed the flex application. We couldn't use html code in flex builder. Would you guys edit the html files via other tools to embed the swf file after the application is completed or there are other ways to do it. Thanks for the reply.

    Hi Jerry,
    Why you couldn't use the html code generated in flex builder. In the html wrapper file generated in FlexBuilder you have SWF embed code directly along with the Flash Player detection javascript code...If your users don't have the FlashPlayer installed or if they don't have the latest Flash Player version installed then the  application will prompt the users to install the latest Flash player plugin..
    What's the problem that you have got by using the html wrapper file generated in FlexBuilder..
    Thanks,
    Bhasker Chari

  • Embed a Flash Application into a Flex Application

    Hello everybody,
    I'd like to know if there is a way to embed a Flash
    Application into a Flex Application. My goal is to wrap Flash apps
    in Flex Modules, and I don't know how to do it.
    I know it is possible to embed swf by using @Embed and an
    mx:Image tag, or to use flash content by creating a flash swc
    component. However these two solutions don't allow to call the
    methods of the Flash app.
    On the other hand, it is possible to load a swf file via the
    Loader Class, and then call the methods via loader.content. But
    with this solution I can't embed the swf in my flex application and
    I have to load it at runtime.
    Any ideas ?

    Look into SWFLoader.
    Be aware though, you can not directly access AS2/FP8/Flash8
    swf's from within an AS2/FP9 app. Local connection is used in this
    case.
    There are dataType and timing issues with SWFLoader. Here is
    a complete example:
    http://www.cflex.net/showfiledetails.cfm?ChannelID=1&Object=File&objectID=690
    Tracy

  • Can I embed the Flash Document preview on my Flex Application

    Hi I am creating a Flex application utilizing acrobat document sharing, and I was wondering if I could have it display a preview of my documents very similar to http://share.acrobat.com/adc/.
    I notice that you can embed flash on webpage by the use of this viewer https://share.acrobat.com/adc/flex/mpt.swf, and I tried loading it and appending necessary variables to it, it works but I cannot resize the viewer. I'm not sure if Im doing it wrong or its just the viewer not compatible at all.
    Thanks, I really appreciate if anyone could point me on the right direction.

    I'm sorry, but at present this isn't something that we support. We didn't build the viewer with the intent of allowing others to use it in flex.
    Best Regards,
    Michelle

  • FlashIsland UI element missing to embed Flex application

    Hi,
    I am trying to add flex application into my webdynpro java . But FlashIsland UI element is not displaying in my NWDS.
    I am using NWDS Version: 7.0.09
                     EP Version: 7.0      SP: 16
    Is there any way to get the FlashIsland UI element in my view?
    Regards
    Vineela

    Hi Vineela,
    To implement Flash Island for Web Dynpro Java applications integrating Flash Islands, you require the following:
    Adobe Flex Builder 2 or 3
    Adobe Flash Player 9 Update 3
    Flash Island Flex library WDIslandLibrary.swc. To enable the use of a Flash/Flex component in Web Dynpro, the component must exist in the form of a FlashIsland. This wrapping enables the communication between the Flex component and the Web Dynpro Framework.
    Are you sure, you are having the required installations available with you. Please check the links below for more information on the same, in case you have missed:
    [Adobe Flash Islands for Web Dynpro Java|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/301e6047-01c9-2b10-3998-a08970c23639]
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/203ece12-85bf-2b10-31a1-cc051670e9c7]
    Please keep posted in case found useful. Thanks!
    Regards,
    Gaurav Bhardwaj

  • Word 2013 (Windows 7 64-bit) - Embed PDF as Icon Error

    We have a process where we embed PDFs into a table in a Word document as an icon.
    This worked for us in Word 2010, but as soon as we upgraded to Word 2013 we started getting an error message.
    "The program used to create this object is Package.  That program is either not installed on your computer or it is not responding.  To edit this object, install Package or ensure that any dialog boxes in Package are closed."
    Nothing has changed except uninstalling Office 2010 and installing Office 2013.  Acrobat is still there(fully updated XI pro). Acrobat is not open when the attempt to embed is made.
    I've tried altering every option I could find that might make this process work, but nothing does the trick.  All software is fully updated as far as I can tell.   It feels like Office 2013 is not keen on the idea of working with PDFs.  The
    Acrobat Add-In seems to only promote converting word docs to PDFs, and I found little to no settings referring to PDF embedding or any embedding for that matter.
    Does Word 2013 disallow this feature unless you're using Windows 8 and the Windows Reader app?  
    Any advice would be fantastic.  Thanks.

    Hi,
    Please try to insert some PDF files from  Insert tab --> Object --> Create New --> Adobe Acrobat Document
    In addition, make sure Adobe Reader is the default application to open the PDF files.
    If the issue persists, please try repair or reinstall the latest version of Adobe reader and check this again.
    Karen Hu
    TechNet Community Support

  • Adobe Product API for converting mulptiple formats into PDF and to Embed PDF into PDF ?

    Hi Team,
    Is there any adobe product that allow us to convert multiple formats into .pdf format and also allow us to attach (embed) other pdf files object into a pdf, is there any .net API for that, I want to do this through programming.
    Regards
    Amit

    We want to use this product for our application, for the purpose of converting different files formats into a PDF file and also for attaching files into a single PDF using a web application and windows service. I have to evaluate some features and point regarding this product which are as below:
    1. PDF form creation in future requirement.
    2. Maximum files size that i can convert into PDF.
    3. Memory management when converting N number of files.
    4. Compatibility with C#, .Net Framework 4.0, using MS Visual Studio 2010.
    5. Support of the product for future.
    6. Primary requirement to use PDFLiveCyle for above features.
    7. Basic guidelines before using PDFLiveCyle.
    8. Ease of coding using PDFLiveCyle.
    9. 32bit or 64bit support.
    10. Lisencing information
    Regards
    Amit Mishra

Maybe you are looking for

  • Ctrl/Alt Keys not Working in Parallels

    Hi, I'm running Illustrator CS6 using Parallels Desktop 8 and Windows 7. It appears that the ctrl/alt keys do not work. Has anyone found a solution? I've tried resetting my preferences and restarting my computer. Any help would be greatly appreciaed.

  • Advance Payment by Customer

    Dear Guru's, The client want to have advance payment in the billing document print out. e. g. the customer will pay crtain % amt as a advance payment before creation of sales order. i.e if the order value is 1000 and the adance is 200 then the billin

  • How to execute SQL Query from the Crystal report X1

    Dear All, I am using crystal report X1. In my application am creating run time MS Access tables and giving table name at run time based on my requirement . From these tables I want to fetch data based on some condition and to display using crystal re

  • Difficulty downloading episodes from your feed, but everything looks good :(

    So I've just started up a podcast and I'm trying to get it in to iTunes, but can't for the life of me figure out what the problem is. The feed is here: http://theinquisitiveatheists.com/podcast.xml It has a single episode, and I can subscribe using t

  • Can't connect to server via apple+k

    If i try and connect to another machine via GO>CONNECT TO SERVER I get the beachball of death which spins forever until I force quit finder. I have created a new user account and if i try the same it works perfectly, which suggests to me a file/prefe