package com.tools.module.document.util;@b@@b@import org.jodconverter.core.office.OfficeException;@b@import org.jodconverter.core.office.OfficeUtils;@b@import org.jodconverter.local.JodConverter;@b@import org.jodconverter.local.office.LocalOfficeManager;@b@@b@import java.io.File;@b@@b@@b@/**@b@ * OpenOffice 文件转换@b@ */@b@public class OpenOfficeService {@b@@b@ static {@b@ LocalOfficeManager.builder()@b@ .portNumbers(2002)@b@ .build();@b@ }@b@@b@ public static void main(String[] args) {@b@ LocalOfficeManager officeManager = LocalOfficeManager.install();@b@ try {@b@ officeManager.start();@b@ JodConverter@b@ .convert(new File("F:\\前端.txt"))@b@ .to(new File("E:\\home\\1.pdf"))@b@ .execute();@b@ } catch (OfficeException e) {@b@ e.printStackTrace();@b@ } finally {@b@ OfficeUtils.stopQuietly(officeManager);@b@ }@b@ }@b@}