このアイデアはインターネットへの私の言及であり、コードは私の実現です。
Apacheの下のOpenOfficeを使用して、リソースファイルをPDFファイルに変換し、PDFファイルをSWFファイルに変換し、FlexPaperで閲覧します。
わかりました、
A. OpenOffice(変換リソースファイル)をダウンロード
B. JodConverter(OpenOfficeを呼び出す)をダウンロードしてください
C. swftoolsをダウンロード(pdf2swf)
D.フレックスペーパーをダウンロード(SWFファイルを参照)
ダウンロードした後、最初にインストールしないでください、このブログ投稿を読んでください
1.まず、骨髄工学構造を見てください
2。Jodconverrer-2.2.2.zipを減圧した後、ダウンロードしました
3. Webrootの下に新しいフレックスペーパーフォルダーを作成し、すべての未butonatedのフレックスペーパーをフレックスペーパーにコピーします
4.新しいbaiduservlet.javaファイルを作成します
com.bidu.io.io.file.io.io.io.inputStream; Imageio.fileimageinputStream .Connection。 OpenOfficeConnection.ArtofSolving.openfinection.Socketofsolving.jodconverter.openoffice.converter.openofficialocumentconverter; 58 * todo:1。最初のステップで、最初に表示する必要があるファイルを取得 * 2、2番目の部分、ファイル(doc、xls、txt、ppt、03 the/07バージョンがpdfに変換されます)、thisステップは、第3部であるOpenOffice *を呼び出し、SWFファイルに変換し、FlexPaperViewer.swfを使用してhttpservletを拡張しますファイルpdffile; // swfターゲットオブジェクトプライベート文字列filepath; {return sourcefile;} public void setSourceFile(file sourceFile){this.sourcefile = sourceFile;} public getpdffile(){return pdffile;} public void setpdffile(file pdffile){this.pdffile = pdffile;} public file getSwffile(){){){) return swffile;} public void setswffile(file swffile){this.swffile = swffile;} public string(){return filepath;} public void setfilepath(string filepath){this.filepath = filepath;} public string getFileName(){return getFileName(){ filename;} public void setFileName(string filename){this.fileName = filename;} public void d oget(httpservletrequest request、httpservletresponse応答)Servletexception、ioexception {string savefilename = request.getParameter println(savefilename); string webpath.getRealPath( "/");新しいファイル(filename + ".pdf"); PDF形式のファイルsrc2pdf(); pdfファイルをswfファイルに変換するpdf2swf();} catch(expert e){e.printstacktrace();} //変換されたファイルをセッションにバインドしますrequest.getSession()。 //ソースファイルはpdfファイルに変換されます){// OpenOfficeが提供する変換サービス=新しいSocketopenofficeConnection(8100); .out.println( "接続成功e););}} else {system.out.println("既に存在するpdfファイル、変更する必要はありません!交差点");}} else {system.out.println("ファイルパスは存在しません!!! "); @throws例外 * todo:pdfはswfファイルに変換されます */ private void pdf2swf()throws exception {if(if( ! "-t 9"; out.println( " +コマンド); ); out.println(p.getinputStream)); .println( "PDFファイルはありません)をスロー{in = new buffuredInputStream(in); buffer.toString();}}
5. index.jspを変更します
<%@ページ言語= "java" image = "java.util。*" pageencoding = "utf-8"%> <! Baidu Libraryのオンラインプレビュー</title> <meta http-equiv = "pragma" content = "no-cache"> <meta http-equiv = "cache-control" content = "no-cache"> <meta http-equiv = "conters" content = "0"> <meta http-equiv = "keywords" content = "keyword1、keyword2、keyword3"> <meta http-equiv = "description ption" content = "これは私のページ> < /head> <body> <a href = "<%= request.getContextPath()%>/baidusevlet?savfile = 1234.xls">オンラインプレビュー</a> </body> </html>
6。BaseFile.jspファイルを書き込みます
<%@ページ言語= "java" contentType = "text/html; charset = utf-8" pageencoding = "utf-8"%> <! en "" http://www.w3.org/tr/html4/loose.dtd"> = html> had> http-equiv = "content-type" content = "text/html; "> <title>オンライン読み取り</table> <スクリプトタイプ=" text/javascript "src =" ../ flexpaper/js/flexpaper_flash.js "> </script> <style type =" text/css "> html 、ボディ{height:100%;}ボディ{マージン:0; :Absolute; viewerplaceholder '、{config:{swffile:escape(' ../ reader/ <%=(string)session.getattribute( "swfname")%> ')、scale:0.6、zoomtransitude:' e e e e e e e aseout '、zoomtime:0.5 、Zoominterval:0.2、FitPageOnload:true、fitwidthonload:false、fullscreenasmaxwindow:false、coldingiveloading:false、maxzoomsize:5、searchMatchall:false、initviewmode: 'alorate'、printpaperasbitmap:false、fals、zoomsbisible:fals、zoomsbisbisible:fals、viewmodetoolsbisbisible:fals :true、cursortoolsvisible:true、searchtoolsvisible:true、localechain: 'zh_cn'}});
basefile.jspのコードに注意してください、ここで参照することはできません
/******************************************* ** **************************************** *
7。ここで完成した、あなたは次のことに注意を払う必要があります
(1)swftools-2013-04-09-1007.exeファイルのインストールパスは深すぎません。
(2)、、、、
2.1、赤い1マークパスは間違っていない、私はこの間違いを犯した
2.2、Red Label 2はhttp://127.0.0.0.1:8080/baidudoc/reader/...も書くことができます。
(3)OpenOfficeのコマンドは直接起動されません。公式ウェブサイトの起動方法で、CDコマンドを使用してインストールディレクトリを開きます!
OpenOfficeをインストールした後
A.インストールサービス
CD C:/プログラムファイル(x86)/OpenOffice4/プログラム
OpenOfficeのインストールが実行される場所を確認できます
soffice -headless -accept = "socket、host = 127.0.0.1、port = 8100; urp;"
B.インストールが成功したかどうかを表示します
2.1ポートに対応するPIDを表示します
netstat -ano |
2.2 PIDに対応するサービスプログラム名を表示
タスクリスト|。
効果アイコン:
上記は、この記事のすべての内容です。