5 Replies Latest reply on Jun 18, 2010 8:48 AM by Ansury

    PDF inside FLEX APPLICATION?

    salima12

      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