Flexpaper Implementation Document online Browsing (source code) 2011-06-16 10:04
1. Overview
Flexpaper is an open source lightweight component that displays various documents in a browser and is designed to work with pdf2swf, making it possible to display PDFs in browsers that do not require the support of a PDF software environment.
You can also convert some documents such as word, PPT, etc. into PDF, and then realize online browsing.
2. Implementation steps
Documents (Pdf,word,ppt etc)----> convert to SWF-----> use FLEXPA online Browsing
2.1. Convert SWF
Need to use a tool, Swftools, currently the latest version is 0.9.1;
Download Address
You can convert a file to a SWF file by using the command line;
For example, the command to convert Paper3.pdf to paper3.swf is:
C:\SWFTools\pdf2swf.exe Paper3.pdf-o paper3.swf
The corresponding program implementation method: (C #) Process PC = new process ();
ProcessStartInfo psi = new ProcessStartInfo ("C:\\swftools\\pdf2swf.exe", "Paper3.pdf paper3.swf");
Pc. StartInfo = PSI;
Pc. Start ();
Pc. WaitForExit ();
For more instructions on the Swftools command, click here to download the documentation.
2.2. Browsing in browsers
First to download Flexpaper, the latest version of the current 1.4.0;
Download Address
Extract to the Web page directory after downloading.
Use the following code in your page to enable browsing of your SWF document.
var params = {
Swffile: "Paper.swf",
scale:0.6
}
swfobject.embedSWF ("flexpaperviewer.swf", "CB", "," "," "," "9.0.0", "js/swfobject/expressinstall.swf" , params)
The Swffile parameter is the file you want to display, scale is a number between 0-1, which indicates the magnification parameter displayed.
Say again, better to see the source code came directly. The source code is here.
The following is the focus of this article (on the Internet can not find the *_*, find no such detail; Hee XI)
3. Parameter list
The official website has, but not my whole. Go to the official website
Parameter name |
parameter values and descriptions |
cursortoolsvisible |
(True/false) |
Fitpageonload |
(True/false) |
Fitwidthonload |
(True/false) |
Fullscreenasmaxwindow |
(True/false) |
fullscreenvisible |
(True/false) |
navtoolsvisible |
(True/false) |
printenabled |
(True/false) |
printtoolsvisible |
(True/false) |
progressiveloading |
(True/false) |
Scale |
|
searchtoolsvisible |
(True/false) |
Startatpage |
|
Swffile |
|
viewmodetoolsvisible |
(True/false) |
Zoominterval |
|
Zoomtime |
|
zoomtoolsvisible |
(True/false) |
zoomtransition |
|
4. Events and FunctionsThis is not much, or list it, but to be detailed please go to the official website to see it. Go to the official website
Function name |
Function description |
GotoPage (number PageNumber) |
Jump to a specific page |
Fitwidth () |
Set to Width mode view |
Fitheight () |
Set to Height mode view |
loadswf (String swffile) |
Load a new SWF file into the browser |
Getcurrpage () |
Get current page number |
NextPage () |
Jump to the next page |
PrevPage () |
Jump to Previous page |
Zoom (number Factor) |
Scaling by factor |
SearchText (String text) |
Search text |
Switchmode (String mode) |
Transform view mode; parameter values can be ("Portrait", "Two Page", "Tile") |
Printpaper () |
Print a loaded document |
onprogress (number bytesloaded, number Bytestotal)
event name |
Event Description |
ondocumentloaded () |
Document loading Fire |
ondocumentloadederror (String errormessage) |
Load document error trigger |
td>
Document is loading when it triggers |