Similar to Baidu pdf2swf + flexpaper, pdf2swfflexpaper solves the effect of online pdf reading.
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
[Php]View plaincopyprint?
- <? Php
- /*
- * Created on 2010-11-17
- *
- * To change the template for this generated file go
- * Window-Preferences-PHPeclipse-PHP-Code Templates
- */
- // Obtain the directory of the object
- $ Dir = dirname (_ FILE __);
- // Delete the test file
- @ Unlink ($ dir. "\ test.swf ");
- // Use the export 2swf conversion command
- $ Command = "D:/SWFTools/ipv2swf.exe-t \"". $ dir. "\ testbench \"-o \"". $ dir. "\ test.swf \"-s flashversion = 9 ";
- // Create a shell object
- $ WshShell = new COM ("WScript. Shell ");
- // Execute the cmd command
- $ OExec = $ WshShell-> Run ("cmd/C". $ command, 0, true );
- ?>
Java example
[Java]View plaincopyprint?
- <%
- /*
- * Created on 2010-11-17
- */
- // Obtain the directory of the object
- String path = request. getRealPath ("/");
- // Use the export 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 is php, java converts pdf to swf, then it is displayed, so we will use flexpaper, the following is the use of flexpaper
Use flexpaper to display swf
[Javascript]View plaincopyprint?
- <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,
- FullScreenAsMaxWindow: false,
- ProgressiveLoading: true,
- PrintToolsVisible: true,
- ViewModeToolsVisible: true,
- ZoomToolsVisible: 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>
- </Div>
- </Body>
Using the above method, we can convert a pdf file into a corresponding swf file and display it through flexpaper to prevent users from downloading or copying.
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.
: PDF2SWF conversion only has one page of PDF document, not displayed in FlexPaper
Version problem. We recommend that you uninstall and reinstall it.
Java + FlexPaper + swfTools design and implementation of an online preview system for Baidu Library Documents
Use the FlexPaper plug-in to convert the word into a pdf file and then convert the pdf file into a swf file. Upload the file and you can use FlexPaper to play the file. Note that the server system is different, so the Delimiter is different. I hope it will be helpful for your thinking.