Posted in ColdFusion | Posted on 08-11-2005 | 2,834 views
Ryan asks:
Okay jedi, how about a slightly harder question. Can I embed a pdf inside a flashform? using something similar to the way I embed a pdf in an html page:
<OBJECT ID="PDF" CLASSID="clsid:CA8A9780-280D-11CF-A24D-444553540000" WIDTH="800" HEIGHT="450"> <PARAM NAME="SRC" VALUE="/testing/testpdf.pdf"> <OBJECT>I have tried wraping it in a <cfformitem type="html"> but it doesnt seem to work. It doesnt throw an error, just nothing shows up. Any ideas?
The short answer is no. Flash's HTML support is pretty limited. From the documentation:
For Flash forms, you can use the following text formatting tags, most of which correspond to HTML tags, in the text: a, b, br, font, i, img, li, p, textformat, and u. For details on using these formatting tags, see the Flash documentation.
You could, of course, link to a PDF file, even with a popup, so a click on the link in the Flash Grid would pop up a window containing the PDF.


It is too bad that we cant embed html natively inside of a swf... I wouldn't even really want the ability to pass variables back and forth (although that would be sweet...) but just a frame of sorts I could put in a swf that I could just put a normal html page in.
Oh well, maybe in flash 9 ;)
So if you are generating your pdf's, you might conisder generating them as flashpaper and going that route.
One other trick to display a foreign file "within" a Flash SWF presentation is to build a four-SWF frame around the other renderer... tables were used in the past, IFRAMES by others, depending on your audience's browsers you might choose other techniques today. With reasonable framerates the CPU hit is tolerable.
Authoring-time or server-time format translations are another option... like Simeon says, Macromedia FlashPaper is a pretty easy way to convert most any office format to SWF.
But embedding any ActiveX Control or Netscape Plugin within a SWF, that's still a difficult thing, agreed.
jd/mm
I completely understand that, I wouldnt want flash to actually render the html/css/js (although, wouldnt that be something!) because you're right, that would balloon the size of the flash player considerably. I was talking about something similar to your four flash swf method. Something like flash with a hole in it if you will. Let the browser do the rendering, just display it in the middle of the swf. Or on top of it would work as well...
VBScript example:
P2F = CreateObject("P2F.Server")
P2F.ConvertDir "C:\docs", "*.pdf", "C:\inetpub\www.mysite.com\swf"
Command line example:
p2fserver.exe C:\ Docs\*.pdf C:\inetpub\www.mysite.com\swf
In the examples all PDFs in the "C:\docs" folder are converted to Flash. The output files are written to the "C:\inetpub\www.mysite.com\swf" folder.
Print2Flash OLE Automation API objects can run using rights of a user different from the user which creates and uses these objects. This allows converting documents from server-side scripts like ASP or PHP.
Print2Flash batch processing also allows you to fine-tune document options like paper size, page orientation, printing resolution, etc. Unlike with FlashPaper the document toolbar and functions can be customized, too.
Print2Flash website:
http://print2flash.com
[Add Comment] [Subscribe to Comments]