FlexPaper + swftools online document reading, flexpaperswftools
There are a lot of articles on the Internet that copy FlexPaper from Baidu Library, and there are also a lot of detailed tutorials in the garden.
In combination with this example, I will record in detail the effect of using Flexpaper to simulate Baidu Library and some minor problems I encountered when I followed the tutorial in the garden. I hope to provide some small help to students who have been in contact for the first time or have encountered the same problem. (To describe the shortcomings, please forgive me. After all, this is the first time I wrote an article in the garden ).
1. Preparation: Download flexpaperand pdf pdf2swf.exe
Flexpaper: Download (my Flash Version 1.4.5 (release notes ))
Pdf2swf tool download: Download (my next is swftools-2011-01-23-1815.exe)
2. Run the official DEMO and Flexpaper usage
Open the downloaded Flexpaper folder, and open the example index.html,
(1) The operator's example cannot find any .swf (including the swf in the example) (skip this step if it can be displayed normally)
When the runtime official example starts, the attached paper.swf file cannot be loaded successfully. It can only be seen that the circle in the upper right corner is always moving and waiting. For example:
This situation is because Flexpaper has not yet gained the trust of Adobe Flash, then you can live in front of the http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04a.html#119065 to add Trust for FlexPaper. after entering the webpage, click the Global Security Settings papel option on the left, and then click)
Add trust to the folder where your example is located. Then you run the official example and you will find that the operation is successful.
(2) Flexpaper usage
Let's refer to the source code of index.html. Let's just talk about its usage:
The usage of the front end is as follows:
<! -- First introduce the jquery library and related js -->
2 <script type="text/javascript" src="js/jquery.js"></script>
3 <script type="text/javascript" src="js/flexpaper_flash.js"></script>
4 <script type="text/javascript" src="js/flexpaper_flash_debug.js"></script>
Only one a tag can be declared for the code in html.
<Body>
<Div> {config :{
SwfFile: escape('ajax.swf '), <! -- This sentence is the key: SwfFile: indicates the path of the imported .swf -->
Scale: 0.6,
ZoomTransition: 'easeout ',
ZoomTime: 0.5,
ZoomInterval: 0.2,
FitPageOnLoad: true,
FitWidthOnLoad: false,
PrintEnabled: true,
FullScreenAsMaxWindow: false,
ProgressiveLoading: false,
MinZoomSize: 0.2,
MaxZoomSize: 5,
SearchMatchAll: false,
InitViewMode: 'portrait ',
ViewModeToolsVisible: true,
ZoomToolsVisible: true,
NavToolsVisible: true,
CursorToolsVisible: true,
SearchToolsVisible: true,
LocaleChain: 'en _ us'
}});
</Script>
</Div>
</Body>
Basically, you can display your Flexpaper on the front end.
(3) only the swf in the official example can be loaded, but other or your own swf cannot be loaded.
When we want FlexPaper to load our own swf, we find that it remains in the waiting status and cannot be displayed. Check the swf path, but it cannot be loaded all the time. The version of the .swf file is quite problematic. We run swftools's Graphics Tool (g4242swf.exe) to Convert pdf to swf, but the converted swf cannot be properly loaded by Flexpaper. If you make sure the path is correct, it is a version issue.
We can view the swf version during conversion. We can click Edit-> Options-> Viewer
We can see that it helps us to convert to the SWF version with two options: 7 and 8, but this is not normally loaded in FlexPaper. We must convert the pdf to the swf of version 9, to display it in Flexpaper. So how to convert to 9? I use the cmd command line tool for manual conversion. you only need to add "-s flashversion = 9" to the command line to convert it to version 9. example:
Parameters are described as follows:
(SWFTools my default installation path is: E: \ Program Files \)
SWFTools: the folder where the cmd2swf.exe tool is located,
-T: source file path, that is, the path of the PDF file to be converted.
-S: Set the parameter. Here we set it to flashversion = 9, which can be converted to version 9.
-O: Path of the output file. Here I output it to the F: disk.
After the conversion is successful, you can copy a .swf file to the Demo you downloaded. After configuring the path, you will find that FlexPaper can load your swf normally.
A small problem is highlighted here: the folder name contains spaces
For the two parameters-t and-o, the problem is that the file path is output from the source file path. If your folder name contains spaces, in this way, you cannot find your file.
For example, the pdf source file to be converted is in the folder E: \ Program Files \ SWFTools \. When I write-t E as follows: \ Program Files \ SWFTools \ ajax.pdf or the output file path is written as-o E: \ Program Files \ SWFTools \ ajax.swf, which cannot be successful because the folder name contains spaces, this should be a problem with the cmd command (I am not very familiar with this, I hope you can say it). Here you can only add quotation marks before and after the path, such: -t "E: \ Program Files \ SWFTools \ ajax.pdf" or-o "E: \ Program Files \ SWFTools \ ajax.swf.
3. Use Asp.net to Convert PDF to SWF using ipv2swf.exe
The Code is as follows:
1 private static void ConvertCmd (string fileName)
2 {
3
4 using (Process p = new Process ())
5 {
6 string character STR = HttpContext. Current. Server. MapPath ("~ /SWFTools/ipv2swf.exe ");
7 string savePath = HttpContext. Current. Server. MapPath ("~ /TestSWF /");
8 // @ "is equivalent to a double quotation mark. The reason why @" is added is to prevent folder names from being converted with spaces, leading to failure.
9 string sourcePath = @ "+ savePath + fileName + @"""";
10 string targetPath = @ "+ savePath + fileName. Substring (0, fileName. LastIndexOf (". ") +". swf "+ @"""";
11 string argsStr = "-t" + sourcePath + "-s flashversion = 9-o" + targetPath;
12 // call a new process for conversion
13 ProcessStartInfo psi = new ProcessStartInfo (repeated STR, argsStr );
14 p. StartInfo = psi;
15 p. Start ();
16 p. WaitForExit ();
17}
18}
Here, my PDF files are stored in ~ In the/TextSWF/folder, the converted swf is also stored in the same folder.
According to the above practice, there should be no problem, so we can make the effect similar to that of Baidu Library.
Well, when I write an article for the first time, there will inevitably be omissions. I hope you will give me some advice and suggestions.
Aspnet + C # online Document Browsing. All the tutorials on the Internet say that SwfTools and Flexpaper are too vague to understand.
Step 1: Convert the source file (DOC) to PDF, and use shell to call adobe and other virtual printers that can be converted to PDF.
Second, Convert PDF to SWF, and use shell to call ipv2swf to convert
Part 3: Play SWF with flexpaper.
Hi me
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.