이 아이디어는 인터넷에 대한 나의 언급이며, 코드는 나의 실현입니다.
Apache 아래의 OpenOffice를 사용하여 리소스 파일을 PDF 파일로 변환 한 다음 PDF 파일을 SWF 파일로 변환 한 다음 FlexPaper로 찾아보십시오.
좋아요,
A. OpenOffice 다운로드 (변환 리소스 파일)
B. JodConverter 다운로드 (오픈 오피스 전화)
C. Swftools 다운로드 (PDF2SWF)
D. FlexPaper 다운로드 (SWF 파일 찾아보기)
다운로드 한 후 먼저 설치하지 마십시오.이 블로그 게시물을 읽으십시오.
1. 먼저 MyClipse 엔지니어링 구조를 살펴보십시오
2. Jodconverrer-2.2.2.zip을 압축 한 후 우리는 우리를 다운로드했습니다
3. Webroot 아래에 새 Flexpaper 폴더를 만들고 Unbuton이없는 모든 Flexpaper를 Flexpaper에 복사하십시오.
4. 새 baiduservlet.java 파일을 만듭니다
com.baidu.util; image.servax.servax.httpservlet; Ice.connection. OpenOfficeConceNect; import com.artofSolving.jodconverter.socket.socketoficeConceNce; 58 * todo : 1. 첫 번째 단계에서 먼저 볼 필요가있는 파일 * 2, 두 번째 부분, 파일 (doc, xls, txt, ppt, 03/07 버전은 pdf로 변환)을 가져옵니다. 단계는 세 번째 부분 인 OpenOffice * 3을 SWF 파일로 변환하고 */public class BaidUseVlet extens httpservlet {ivate 소스 파일; PDFFILE; // PDF 중간 파일 객체 SWF 대상 객체 개인 문자열 FILEPATH; {return sourcefile;} public void setSourcefile (파일 소스 파일) {this.sourcefile = sourcefile;} public getpdffile () {return pdffile;} public void setpdffile (파일 pdffile) {this.pdffile = pdffile; {public file getswfile () { return swffile;} public void setswffile (파일 swffile) {this.swffile = swffile;} public string () {return filepath;} public void setfilepath (String filepath) {this.filepath = filepath;} public string getFilename () {return filename;} public void setfilename (String filename) {this.filename = filename;} public void d ooget (httpservletrequest request, httpservletreponse 응답) servletexception {string savefilename = request. println (savefilename); string webpath = getRealPath ( "/"); 새 파일 (filename + ".pdf") PDF 형식 파일 SRC2PDF ()로 {// 2. PDF 파일을 SWF 파일 PDF2SWF ()로 변환합니다 (예외 E) {e.printstacktrace ();} // 변환 된 파일을 세션에 바인딩합니다. requfile.getSession (). // 소스 파일은 pdf 파일*/private void src2pdf () {if (sourcefile.exist ()) {// 존재하지 않으면 pdf 파일 (! pdffile .exists)로 전송해야합니다. ) {// OpenOffice OpenOfficeConceNect가 제공하는 전환 서비스를 활성화합니다. CONTER = OpenOffice 서버 연결 {Conn.Connect (); .out.println ( "Connection Success E););}} else {System.out.println ("이미 PDF 파일이 존재하며 변경할 필요가 없습니다! 교차로 ");}} else {system.out.println ("파일 경로가 존재하지 않습니다 !!! "); @throws Exception * todo : pdf는 swf 파일 */ private void pdf2swf ()로 변환됩니다. swffile.exists ()) {if (pdffile.exists ())) {String Command = "C : // pdf2swf / /pdf2swf.exe" + " +" -" + swffile.getPath () + "-t 9"; "변환 명령 :" + 명령); system.out.println (p.getInputStream)); .println (pdf 파일이 없음); int len = 0; buffer.tostring ();}}
5. index.jsp를 수정하십시오
<%@ page language = "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 = "만료"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 파일을 쓰십시오
<%@page language = "java"contmenttype = "text/html; charset = utf-8"pageencoding = "utf-8"%> <! ko ""http://www.w3.org/tr/html4/loose.dtd">=html> hdtp-equiv = "content-type"content = "text/html; "> <title> 온라인 읽기 </table> <script type ="text/javascript "src ="../ flexpaper/js/flexpaper_flash.js "> </script> <style type ="text/css "> html , Body {Height : 100%;} body {margin : 0; 오버플로;}#display;} </style> </head> <div style = "pos ition. : 절대; 왼쪽; 10px; ViewerPlaceHolder ', {config : {swffile : evale ('../ reader/ <%= (string) session.getAttribute ( "swfname")%> '), scale : 0.6, Zoomtransitude :'e e e e e e aseout ', Zoomtime : 0.5 ZoominterVal : 0.2, FitPageOnload : True, FitwidThonload : False, FullscreenAsmaxWindow : False, Progressiving : False, MaxZoomsize : 5, SearchMatchall : False, InitViewMode : 'PortappaperAsbitMap : False, ViewModetOlsible : True, Zoomtoolsible : True, invuctoverible : True, Navtoolsible :'Portappaper ' : true, cursortoolsvisible : true, searchToolsvisible : true, localechain : 'zh_cn'});
Code는 BaseFile.jsp에서 여기에서 참조 할 수 없습니다.
/******************************************* *********************************************** *
7. 여기에서 완료하면 다음에주의를 기울여야합니다.
(1) SWFTOOLS-2013-04-09-1007.EXE 파일 설치 경로는 너무 깊지 않습니다. 그렇지 않으면 Java 호출 외부 명령이 실행할 수 없습니다.
(2) ,,,,
2.1, 빨간색 1 마크 경로는 잘못 될 수 없습니다.
2.2, 빨간색 레이블 2는 http : //127.0.0.0.1 : 8080/baidudoc/reader/...
(3) OpenOffice의 명령은 직접 시작되지 않습니다. 공식 웹 사이트 시작 방법에서 CD 명령을 사용하여 설치 디렉토리를 엽니 다!
OpenOffice를 설치 한 후
A. 설치 서비스
CD C :/Program Files (x86)/OpenOffice4/프로그램
OpenOffice 설치가 어디에서 실행되는지 확인할 수 있습니다
Soffice -Headless -Accept = "소켓, 호스트 = 127.0.0.1, 포트 = 8100; URP;"
B. 설치가 성공했는지 여부를보십시오
2.1 포트에 해당하는 PID를 봅니다
netstat -ano | findstr "8100"
2.2 PID에 해당하는 서비스 프로그램 이름보기
작업 목록 |. Findstr "IPD 값"
효과 아이콘 :
위는이 기사의 모든 내용입니다.