Discussion on online preview of PDF and Word documents in forums

Source: Internet
Author: User

Forum Engine: Discuz! 2.5

Tools: Flexpaper1.5.6 secondary development version

This article focuses on the general ideas and related technical difficulties. It is a small development in my spare time and only for discussion ,,,

Effect

Why does the Forum need the online preview function? Why does the company's forum need this function? Do you still need to download it? You won't be able to read it directly ,,,

For the secondary development of flexpapaer, refer to the previous article: Secondary Development Summary and Discussion of flexpaper.

The main difference here is diyflexpaper. mxml.

<? XML version = "1.0" encoding = "UTF-8"?> <Mx: Application xmlns: MX = "http://www.adobe.com/2006/mxml" xmlns: fp = "com. devaldi. controls. flexpaper. * "layout =" absolute "width =" 100% "Height =" 100% "applicationcomplete =" initapp (); "> <mx: SCRIPT> <! [CDATA [[Bindable] public VaR _ scale: Number = 1; // scale [Bindable] public VaR _ encodeuri: Boolean = true; [Bindable] public VaR _ swffile: string = ""; // SWF file path [Bindable] public VaR _ zoomtransition: String = "easeout"; [Bindable] public VaR _ zoomtime: Number = 0.6; [Bindable] public VaR _ zoominterval: Number = 0.1; [Bindable] public VaR _ minzoomsize: Number = 0.3; [Bindable] public VaR _ maxzoomsize: Number = 5; [Bindable] public VaR _ fitpageonload: Boolean = false; // suitable for height after loading [Bindable] public VaR _ fitwidthonload: Boolean = true; // after loading, the appropriate width is [Bindable] public VaR _ printenabled: Boolean = false; // whether [Bindable] public VaR _ fullscreenasmaxwindow: Boolean = false is supported; // whether to pay full screen [Bindable] public VaR _ progressiveloading: Boolean = false; // whether to delay loading [Bindable] public VaR _ localechain: String = "zh_cn "; // language private var isfocus: Boolean = false; // initialization parameter private function initapp (): void {_ scale = 1; _ swffile = This. loaderinfo. parameters. URL; _ encodeuri = true; _ zoomtransition = "easeout"; _ zoomtime = 0.6; _ minzoomsize = 0.2; _ maxzoomsize = 5; _ zoominterval = 0.1; _ fitpageonload = false; _ fitwidthonload = true; _ printenabled = false; _ fullscreenasmaxwindow = false; _ progressiveloading = true; _ localechain = "zh_cn"; // language // register event listening this. addeventlistener (mouseevent. mouse_over, onmouseover); this. addeventlistener (mouseevent. mouse_out, onmouseout);} // --------------------------- event ------------------------------ private function onmouseover (Event: mouseevent): void {This. isfocus = true;} private function onmouseout (Event: mouseevent): void {This. isfocus = false;}]> </MX: SCRIPT> <FP: flexpaperviewer id = "flexpaper" width = "100%" Height = "100%" scale = "{_ scale}" swffile = "{_ swffile}" zoomtransition = "{_ zoomtransition }" zoomtime = "{_ zoomtime}" Expiration = "{_ minzoomsize}" maxzoomsize = "{_ interval}" zoominterval = "{_ zoominterval}" fitpageonload = "{_ fitpageonload }" fitwidthonload = "{_ fitwidthonload}" encodeuri = "{_ encodeuri}" fullscreenasmaxwindow = "{_ fullscreenasmaxwindow}" Progress = "{_ progressiveloading}"/> </MX: application>

Here, this. loaderinfo. Parameters. url is used to obtain the address parameter for loading the flash, not the parameter of the current URL address. The main purpose of this modification is to pass the parameter when the Forum loads flexpaper.

Now, flexpaper is ready. Let's add a plug-in to the Forum.

Log on to the discuz forum management center as an administrator and select

Discuz code, the specific operation is very simple, do not elaborate, add a custom code to go to the details: the main settings are as follows:

Replace content:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="[url=http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0][color=#0000ff]http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0[/color][/url]" width="{1}" height="{2}" type="application/x-shockwave-flash"><param value="true" name="allowfullscreen"><param name="allowScriptAccess" value="always"><param name="movie" value="http://192.168.0.200/flexpaper/Diyflexpaper.swf?url={3}"><param name="quality" value="high"><param name="bgcolor" value="#ffffff"><embed src="http://192.168.0.200/flexpaper/Diyflexpaper.swf?url={3}" quality="high" bgcolor="#ffffff" width="{1}" height="{2}" allowScriptAccess="always"allowfullscreen="true"  type="application/x-shockwave-flash" pluginspage="[url=http://www.macromedia.com/go/getflashplayer][color=#0000ff]http://www.macromedia.com/go/getflashplayer[/color][/url]" wmode="transparent" /></object>

Http: // 192.168.0.200/flexpaper/diyflexpaper.swf This Is My flexpaper address
Number of parameters: 3

Parameter prompt:

Enter the reader width. Enter the height of the reader. Enter the flash Address to be opened:

Other Default values: after submission, add the user group permission. You can see the following mark when posting:


The flash Address opened here is.../SWF/1.swf. the flash Address is discussed below:

1. This address is the file address that has been converted from PDF to SwF. This article is manually converted and uploaded to the server. How can this address be used by general users?

This forum is all developed using PHP. I really don't know it. Otherwise, I can write a background Conversion Program. Here, let the user input the address as the file address of the client PDF or something, after submission, the Conversion Program uploads and converts the files, which is perfect.

 

Author:Kunoy Source:Http://blog.csdn.net/kunoy Statement:The authors write blogs to sum up experience and exchange learning.
If you need to reprint the statement, please keep it as much as possible and provide the original article connection clearly on the article page. Thank you!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.