Flex + JS = PDF Reader "in flex" - Source


After having published a post with an example of an alternative practices to "reading" of a PDF in flex, which is nothing more than an iframe overlapped to a certain area controlled by flex ... you can see the post Flex + PDF - Alternative practices for more information ...

Then I made an example in which it is separated into two sections, the flex itself, using an iFrame component (component found in the example I saw a while ago, and the author does not know where I am sorry for not knowing state) and the second part consists for some functions in javascript that the flex flame to control the position of the iframe and open the PDF.

JavaScript is the office / instructions:

  moveIFrame function (x, y, w, h) ( 
  ); var frameRef = document.getElementById ( "myFrame"); 
  FrameRef.style.left = x; 
  FrameRef.style.top = y; 
  ); var iFrameRef = document.getElementById ( "myIFrame"); 
  IFrameRef.width = w; 
  IFrameRef.height = h; 
  ) 
  hideIFrame function () ( 
  ; document.getElementById ( "myFrame"). style.visibility = "hidden"; 
  ) 
  showIFrame function () ( 
  ; document.getElementById ( "myFrame"). style.visibility = "visible"; 
  ) 
  loadIFrame function (url) ( 
  +url+ "'frameborder='0'></iframe>" ; document.getElementById ( "myFrame"). innerHTML = "<IFRAME id='myIFrame' src='" +url+ "'frameborder='0'> </ iframe>"; 
  ) 

and at the end of the iframe html:

  <div id = "myFrame" style = "position: absolute; background-color: transparent; border: 0px; visibility: 
  hidden; "> </ div> 

All these functions are added to the HTML generated by flex, in the example it provides is a index_JS_Template.html that is used and can be seen as the code is organized. Please note that the example only works on a server (online) because it gives an error of offline sandbox.

They can see the example with source code available:

http://www.msdevstudio.com/blog/flexSource/testPDFIframe/

and directly access the source code at:

http://www.msdevstudio.com/blog/flexSource/testPDFIframe/srcview/

It is not quite the most logical option, but is one of the few that allows almost "trick" the user leading him to believe that the PDF is actually incorporated into the flex .. all this because while the flash does not really like dealing with PDF's.

I hope it will be useful.

Hug.

pdf version temporarily unavailable.
Leave a comment or Leave a Trackback

One Trackback

  1. [...] Latest Entries' Latest Comments' Popular Entries' 'Flex + JS = PDF Reader "in flex" - Source "Flex Action Script MP3 Player + Equalizer" Action Script 3 - The Book. Winners [...]

Leave a comment

Your email is never published or shared. Required fields are marked with an *