Java + FlexPaper + swfTools Online Preview demo, flexpaperswftools
1. Overview
Principle
1. Use a third-party openoffice tool to convert files such as word, excel, ppt, and txt to PDF files.
2. Use swfTools to Convert PDF files into swf files
3. Use the FlexPaper document component to display on the page
2.Download the installation package
1. openoffice is an open and free text processing software under Apache.
: Apache oppenoffice official website download version-3.4.1
2. SWFTools is a set of tool kits used to process Flash swf files. We use it to Convert PDF files into swf files!
: Connection: http://pan.baidu.com/s/1pLL8oL9 password d2bf
3. FlexPaper is an open-source lightweight component that displays various documents in a browser.
: Link: http://pan.baidu.com/s/1kUONYBH password: ueqi
4. JODConverter: a Java OpenDocument file converter. Here we only use its jar package.
: Link: http://pan.baidu.com/s/1bZpGkQ password: iiyw
3.Installation File
1. Install the downloaded file (except JODConverter). The drive letter can be set as needed! Note that after openoffice is installed, you need to open its service when using it. In this case, we need to run the following command:
Open the dos window, enter the openoffice installation drive letter, and enter the following code to start the service:
Soffice-headless-accept = "socket, host = 127.0.0.1, port = 8100; urp;"-nofirststartwizard
Note the '-' in front of the last command. Do not write an error! The service cannot start, but the project cannot continue.
3. Development Process
The folder is copied to the root directory of the website (this file is mainly used in the player that plays the swf file on the webpage). The directory structure is as follows:
2. Create docUploadConvertLocalAction. jsp
<% @ Page language = "java" contentType = "text/html; charset = UTF-8" pageEncoding = "UTF-8" %> <% @ page import = "java. io. * "%> <% @ page import =" java. util. enumeration "%> <% @ page import =" com. oreilly. servlet. multipartRequest "%> <% @ page import =" com. oreilly. servlet. multipart. defaultFileRenamePolicy "%> <% @ page import =" com. estone. test. docConverterLocal "%> <! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 Transitional // EN" "http://www.w3.org/TR/html4/loose.dtd">
4. Deployment and release
Start tomcat and deploy the current web Application
Enter http: // localhost: 8080/ctcesimslocal/docUploadConvertLocalAction. jsp in the address bar, for example:
Source code download link: http://pan.baidu.com/s/1pKLsa0b password: 3v3q