cool hit counter javadevelop_ Imitation of Baidu Library_OpenOffice2PDF_ caveat emptor_Intefrankly

javadevelop_ Imitation of Baidu Library_OpenOffice2PDF_ caveat emptor


In the process of imitating the operation of the Baidu library, there are many friends reflected out some problems, is I remembered to write this blog.

The main point is to get people to pay attention to something in the process of doing it, otherwise it won't achieve the desired effect.

Step 1: We start with javadevelop_ Imitation of Baidu Library_OpenOffice2PDF_ Source Code Download Download the source code in this blog.

Or download the source code directly from here.http://files.cnblogs.com/hongten/Office2PDF.rar

Step 2: We downloaded the source code and unpacked the file. Then start your Eclipse.

Step 3: Import (Import) your unpacked source code into your Eclipse working directory (workspace).

Or, you rebuild a project in Eclipse and copy the corresponding files to the directory of the project you have built (e.g., for files under src, copy them to the src directory; for files under lib, copy them to the lib directory; just note their paths. )

Step 4: Set your project's build path to bring in the jar packages under the lib. Set jre's version to 1.7. (I've tested it, jre1.6 doesn't work! )

Step 5: Run the program and the console outputs the results

 fourth month (of the lunar year) 19, 2014 6:47:07  afternoon org.artofsolving.jodconverter.office.ProcessPoolOfficeManager <init>
INFO: ProcessManager implementation is PureJavaProcessManager
 fourth month (of the lunar year) 19, 2014 6:47:07  afternoon org.artofsolving.jodconverter.office.OfficeProcess start
INFO: starting process with acceptString 'socket,host=127.0.0.1,port=2002,tcpNoDelay=1' and profileDir 'C:UsersADMINI~1AppDataLocalTemp.jodconverter_socket_host-127.0.0.1_port-2002'
 fourth month (of the lunar year) 19, 2014 6:47:07  afternoon org.artofsolving.jodconverter.office.OfficeProcess start
INFO: started process
 fourth month (of the lunar year) 19, 2014 6:47:14  afternoon org.artofsolving.jodconverter.office.OfficeConnection connect
INFO: connected: 'socket,host=127.0.0.1,port=2002,tcpNoDelay=1'
 documents:e:/test.docx
 convert to
 target document:e:	est_1397904427299.pdf
 success!
 fourth month (of the lunar year) 19, 2014 6:47:23  afternoon org.artofsolving.jodconverter.office.ProcessPoolOfficeManager stop
INFO: stopping
 fourth month (of the lunar year) 19, 2014 6:47:23  afternoon org.artofsolving.jodconverter.office.OfficeConnection$1 disposing
INFO: disconnected: 'socket,host=127.0.0.1,port=2002,tcpNoDelay=1'
 fourth month (of the lunar year) 19, 2014 6:47:23  afternoon org.artofsolving.jodconverter.office.ManagedOfficeProcess doEnsureProcessExited
INFO: process exited with code 0
 fourth month (of the lunar year) 19, 2014 6:47:23  afternoon org.artofsolving.jodconverter.office.ProcessPoolOfficeManager stop
INFO: stopped
 fourth month (of the lunar year) 19, 2014 6:47:23  afternoon org.artofsolving.jodconverter.office.ProcessPoolOfficeManager <init>
INFO: ProcessManager implementation is PureJavaProcessManager
 Time consuming file conversion:[9129]ms
 fourth month (of the lunar year) 19, 2014 6:47:23  afternoon org.artofsolving.jodconverter.office.OfficeProcess start
INFO: starting process with acceptString 'socket,host=127.0.0.1,port=2002,tcpNoDelay=1' and profileDir 'C:UsersADMINI~1AppDataLocalTemp.jodconverter_socket_host-127.0.0.1_port-2002'
 fourth month (of the lunar year) 19, 2014 6:47:23  afternoon org.artofsolving.jodconverter.office.OfficeProcess start
INFO: started process
 fourth month (of the lunar year) 19, 2014 6:47:24  afternoon org.artofsolving.jodconverter.office.OfficeConnection connect
INFO: connected: 'socket,host=127.0.0.1,port=2002,tcpNoDelay=1'
 documents:e:/test.pptx
 convert to
 target document:e:	est.pdf
 success!
 fourth month (of the lunar year) 19, 2014 6:47:28  afternoon org.artofsolving.jodconverter.office.ProcessPoolOfficeManager stop
INFO: stopping
 fourth month (of the lunar year) 19, 2014 6:47:28  afternoon org.artofsolving.jodconverter.office.OfficeConnection$1 disposing
INFO: disconnected: 'socket,host=127.0.0.1,port=2002,tcpNoDelay=1'
 fourth month (of the lunar year) 19, 2014 6:47:28  afternoon org.artofsolving.jodconverter.office.ManagedOfficeProcess doEnsureProcessExited
INFO: process exited with code 0
 fourth month (of the lunar year) 19, 2014 6:47:28  afternoon org.artofsolving.jodconverter.office.ProcessPoolOfficeManager stop
INFO: stopped
 Time consuming file conversion:[3993]ms

Screenshot of the results from my side.

docsx test.

pptx test.

ATTENTION:

In doing so, you may be involved in modifying the code of.

1 // the first part: the main function, mainly to modify the test document paths such as: e:/test.pptx, e:/test.xls and so on
2 public static void main(String[] args) {
3         Office2PDF office2pdf = new Office2PDF();
4         office2pdf.openOfficeToPDF("e:/test." + OFFICE_XLS, "e:/test_" + OFFICE_DOCX + "2" + OFFICE_TO_PDF + new Date().getTime() + "." + OFFICE_TO_PDF);
5         office2pdf.openOfficeToPDF("e:/test." + OFFICE_PPTX, null);
6     }
  1 // Part 2: Modify the installation directory of Openoffice, mine is installed on D drive and is Windows 7
 2 public String getOfficeHome() {
 3         String osName = System.getProperty("os.name");
 4         if (Pattern.matches("Linux.*", osName)) {
 5             return "/opt/openoffice.org3";
 6         } else if (Pattern.matches("Windows.*", osName)) {
 7             return "D:\OpenOffice 4";
 8         } else if (Pattern.matches("Mac.*", osName)) {
 9             return "/Application/OpenOffice.org.app/Contents";
10         }
11         return null;
12     }

Recommended>>
1、Humanity in 300 years
2、How does an awesome programmer come up with a name that is recognizable and has personality
3、Brushing up on friends Its all about freedom of wealth
4、What is Javascript
5、What every backend programmer should know

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号