Materials List:
Source code download: http://code.google.com/p/flexpaper/
Official documents: http://flexpaper.devaldi.com/docs.htm
SWF tool download: http://www.swftools.org/download.html
1. Convert PDF images to SwF (SwF tools)
Download http://www.swftools.org/swftools-0.9.1.exeand install it at c:#program files \ swftools.
There is a graphical tool, but we want to use a program to call it, so use the command line.
CMD
CD/d c: \ Program Files \ swftools
Rem view help
Pdf2swf-h
Rempdf to SwF (the entire file format)
20172swfe: \ mysql1_- o e: \ mysql.swf-T 9-F
Image Conversion Tool: gif2swf, ipv2swf, and png2swf. It can be used to convert images of this project to SWF.
For specific parameters, see the appendix.
2. Use flexpager to display SWF
Download http://flexpaper.googlecode.com/files/FlexPaper_1.4.7_flash.zip
Decompress the package to any location (it is best to use nginx, IIS, or tomcat to publish it, and the access address is http: // localhost)
I have provided the code. Test it.
3. How to Use Java to execute command lines for conversion
3.1. Idea 1: conversion upon upload (the number of users is small, the number of documents is small, and the user experience is good)
3.2. Idea 2: make a scheduled task conversion (large user volume, large documentation, users cannot view the effect immediately)
Key Points of programming: how to call a command line?
Final process implements runtime.getruntime(cmd.exe C (CMD). The core code is basically like this. CMD is a command line.
4. How to Implement conversion on different platforms through programming
Programming tips: run on Unix-like (including Linux) and widows platforms:
You can use
Org. Apache. commons. lang3.systemutils. is_ OS _unix
Org. Apache. commons. lang3.systemutils. is_ OS _windows
To determine different platforms.
Appendix
Add the "-T 9" parameter and set the output version to flash9. This solves the problem that only one page of the PDF file is available and the generated SWF cannot be played. (For the unverified parameters found online, see Appendix B)
Note:-T 10 won't work. If you have any problems, I have tried this. You can try the latest trunk on ipv2swf.
Sometimes a conversion error occurs. Do not worry about it. Use the command line whenever possible.
Appendix B: For more information about the parameters of iis2swf, see <G id = "1"> cmd2swf-H </G>)
-H,-help print short help message and exit print help information
-V,-version print version info and exit print version number
-O,-output file.swf direct output to file.swf. If file.swf contains '000000' (file13568630.swf), then each page specifies the output SWF file name
-P,-pages range convert only pages in range with range e.g. 1-20
Or1, 4, 6, 9-11 or
Specifies the page range for conversion. The page number description method is the same as that used when the printer prints a file.
-P,-Password Use password for deciphering the pdf. Specify the password for opening the PDF.
-V,-verbose be verbose. use more than one-V for greater effect. Detailed content is output during conversion.
-Z,-zlib use flash 6 (MX) zlib compression. use flash 6's zlib compression Mechanism
-I,-ignore allows into 2swf to change the draw order of the PDF. This maymake the generated allows the program to modify the drawing sequence of the PDF, which may result in a different result from the original
-J,-maximum quality set quality of embedded JPEG pictures toQuality. 0 is worst (small) and 100 is best (BIG ). (default: 85) set the quality of the JPEG image to be converted from 0 to 100. The default value is 85.
-S,-set Param = value set a SwF encoder specific parameter. See parameters 2swf-shelp for more information. set parameters for SwF transcoding. You can obtain specific parameters using the help function of ipv2swf-s.
-W,-samewindow when converting PDF hyperlinks, don't make the links open a new window. Set the converted SWF to use the same window when opening the connection in the original PDF.
-T,-Stop insert a stop () command in each page. Add a stop () command at the end of each page.
-T,-flashversion num set flash version in the SWF header to num. Set the Flash version used by SWF
-F,-fontdir directory add directory to the font search path. specifies the path of the font file
-B,-defaultviewer link a standard viewer to the SWF file. Specify the default SWF navigation file to flip pages, zoom in and out
-L,-defaultloader link a standard preloader to the SWF file which willbe displayed while the main SWF is loading. Specify the default SWF file to display the loading process effect.
-B,-Viewer filename link viewer filename to the SWF file. Specify the SWF navigation file, which works the same as-B.
-L,-preloader filename link preloader filename to the SWF file. Specify the SWF file to be loaded.
-Q,-Quiet suppress normal messages. Use-QQ to suppress warnings, also. Do not print common information, do not print warning information with-QQ.
-S,-shapes don't use SWF fonts, but storeeverything as shape. No font is used, and all are converted into shapes.
-F,-fonts store full fonts in SWF. (Don't forget ceto used characters). Save All fonts in SWF.
-G,-flatten remove as your clip layers from file as possible. Remove the film layers in the file as much as possible and merge them.
-I,-Info don't do actual conversion, justdisplay a list Of all pages in the PDF. No actual conversion is performed, only PDF information is displayed.
-Q,-maxtime n abort conversion after n seconds. Only available on Unix. Exit if the running time times out.
Appendix C: systemutils reference
Org. Apache. commons. lang3.systemutils reference
Is_ OS _unix
Publicstatic final Boolean is_ OS _unix
Istrue if this is a UNIX like system, as in any of Aix, HP-UX, Irix, Linux, MacOSX, Solaris or Sun OS.
Thefield will return false if OS _name is null.
Since:
2.1
Is_ OS _windows
Publicstatic final Boolean is_ OS _windows
Istrue if this is windows.
Thefield will return false if OS _name is null.
Since:
2.0
Appendix D: Official Document reference
1. Introduction
Http://flexpaper.devaldi.com/docs.jsp
2. convertingdocuments. Pay attention to the parameters.
Http://flexpaper.devaldi.com/docs_converting.jsp
3. largedocuments: how to convert large files
Http://flexpaper.devaldi.com/docs_largedocs.jsp
4. Complete parameter reference, the most up-to-date and authoritative
Http://flexpaper.devaldi.com/docs_parameters.jsp