1. Prepare the tool
Download swftools.exe
Http://www.swftools.org/download.html
Install to drive d
Swftools provides a series of tools to convert various files into SWF:
Font2swf.exe
Gif2swf.exe
Ipv2swf.exe
Ipv2swf.exe
Png2swf.exe
Wav2swf.exe
Here we only use ipv2swf.exe
Flexpaper download
Http://code.google.com/p/flexpaper/
Here we use the compiled flexpaper flash version.
2: Example language. Here I use two development environments as an example.
PHP example
SWF file generated by PDF
Javacode
<%/** Created on 2010-11-17 * // obtain the file directory string Path = request. getrealpath ("/"); // use the escape 2swf conversion command string command = "D: /swftools/ipv2swf.exe-T \ "" + path + "\ test1_\"-O \ "" + path + "\ test.swf \"-S flashversion = 9 "; // execute the CMD command runtime.getruntime(cmd.exe C ("CMD/C" + command); %>
The above shows how Java converts a PDF file to a SWF file, so we will use flexpaper, which is the use of flexpaper.
Use flexpaper to display SWF
<SCRIPT type = "text/JavaScript" src = "JS/swfobject. JS "> </SCRIPT> <SCRIPT type =" text/JavaScript "> var swfversionstr =" 10.0.0 "; var xiswfurlstr =" playerproductinstall.swf "; var flashvars = {swffile: escape ("test.swf"), scale: 0.6, zoomtransition: "easeout", zoomtime: 0.5, zoominterval: 0.1, fitpageonload: false, fitwidthonload: True, printenabled: True, enabled: false, visibility: True, printtoolsvisible: True, viewmod=lsvisible: True, visibility: True, fullscreenvisible: True, navtoolsvisible: True, cursortoolsvisible: True, searchtoolsvisible: True, localechain: "zh_cn"}; var Params = {} Params. quality = "high"; Params. bgcolor = "# ffffff"; Params. allowScriptAccess = "samedomain"; Params. allowfullscreen = "true"; var attributes = {}; attributes. id = "flexpaperviewer"; attributes. name = "flexpaperviewer"; swfobject. embedswf ("flexpaperviewer.swf", "flashcontent", "650", "500", swfversionstr, xiswfurlstr, flashvars, Params, attributes); swfobject. createcss ("# flashcontent", "display: block; text-align: Left;"); </SCRIPT> <body> <Div style = "position: absolute; left: 10px; top: 10px; "> <Div id =" flashcontent "> </div> </body>
The detailed parameter description of ipv2swf can be found on Baidu or Google, but it is best to specify flashversion as 9 to prevent unexpected errors.
Not all PDF files can be converted in iis2swf, but the encrypted PDF file cannot be converted.
For more information about flexpaper parameters, see
Http://code.google.com/p/flexpaper/wiki/Parameters
Flexpaper API http://code.google.com/p/flexpaper/wiki/API
If garbled characters occur, it may be character sets. There are many solutions on the Internet to query [I have not encountered Character Set blocking problems ].
In addition, images in PDF may not be clear after being converted to SWF.
Word, WPS, TXT and other documents can also be converted in this way, but the tool is not necessarily set as swftools
The uploaded flexpaper attachment contains files in flexpaper. You do not need to download them again. You only need to download swftools and install it.
The flexpaper attachment contains the ipv2swf. jsp and ipv2swf. php files and flexpaper-related components that can be run in the Java or PHP environment.
If the character set is missing, please refer to this article.Article
Http://xianglp.iteye.com/blog/849190
Reprinted on http://xianglp.iteye.com/blog/814027