Java Code Examples for org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration#setPortNumbers()

The following examples show how to use org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration#setPortNumbers() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OpenOfficePDFConverter.java    From jeewx with Apache License 2.0 6 votes vote down vote up
public static void startService() {
	DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();
	try {
		// 准备启动服务
		configuration.setOfficeHome(OFFICE_HOME);// 设置OpenOffice.org安装目录
		// 设置转换端口,默认为8100
		configuration.setPortNumbers(port);
		// 设置任务执行超时为5分钟
		configuration.setTaskExecutionTimeout(1000 * 60 * 5L);
		// 设置任务队列超时为24小时
		configuration.setTaskQueueTimeout(1000 * 60 * 60 * 24L);

		officeManager = configuration.buildOfficeManager();
		officeManager.start(); // 启动服务
		org.jeecgframework.core.util.LogUtil.info("office转换服务启动成功!");
	} catch (Exception ce) {
		org.jeecgframework.core.util.LogUtil.info("office转换服务启动失败!详细信息:" + ce);
	}
}
 
Example 2
Source File: OpenOfficePDFConverter.java    From jeecg with Apache License 2.0 6 votes vote down vote up
public static void startService() {
	DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();
	try {
		// 准备启动服务
		configuration.setOfficeHome(OFFICE_HOME);// 设置OpenOffice.org安装目录
		// 设置转换端口,默认为8100
		configuration.setPortNumbers(port);
		// 设置任务执行超时为5分钟
		configuration.setTaskExecutionTimeout(1000 * 60 * 5L);
		// 设置任务队列超时为24小时
		configuration.setTaskQueueTimeout(1000 * 60 * 60 * 24L);

		officeManager = configuration.buildOfficeManager();
		officeManager.start(); // 启动服务
		log.info("office转换服务启动成功!");
	} catch (Exception ce) {
		log.info("office转换服务启动失败!详细信息:" + ce);
	}
}
 
Example 3
Source File: WebappContext.java    From kbase-doc with Apache License 2.0 5 votes vote down vote up
public WebappContext(ServletContext servletContext, OpenOffice openOffice) {
	DiskFileItemFactory fileItemFactory = new DiskFileItemFactory();
	fileUpload = new ServletFileUpload(fileItemFactory);
	if (openOffice.getFileSizeMax() != null) {
		fileUpload.setFileSizeMax(Integer.parseInt(openOffice.getFileSizeMax()));
		logger.info("max file upload size set to " + openOffice.getFileSizeMax());
	} else {
		logger.warn("max file upload size not set");
	}
	
	DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();
	if (openOffice.getPort() != null) {
		String ports = openOffice.getPort();
		String[] portArr = ports.split(",");
		int[] portArrInt = new int[portArr.length];
		int i = 0;
		for (String port : portArr){
			portArrInt[i++] = Integer.parseInt(port);
		}
	    configuration.setPortNumbers(portArrInt);
	}
	if (openOffice.getHome() != null) {
	    configuration.setOfficeHome(new File(openOffice.getHome()));
	}
	if (StringUtils.isNotBlank(openOffice.getProfile())) {
	    configuration.setTemplateProfileDir(new File(openOffice.getProfile()));
	}

	officeManager = configuration.buildOfficeManager();
	documentConverter = new OfficeDocumentConverter(officeManager);
}
 
Example 4
Source File: OfficePDFConverter.java    From sun-wordtable-read with Apache License 2.0 5 votes vote down vote up
public static void startService(){  
    DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();  
    try {
    	System.out.println("准备启动服务....");
        configuration.setOfficeHome(OPEN_OFFICE_HOME);//设置安装目录  
        configuration.setPortNumbers(OPEN_OFFICE_PORT); //设置端口  
        configuration.setTaskExecutionTimeout(1000 * 60 * 5L);  
        configuration.setTaskQueueTimeout(1000 * 60 * 60 * 24L);  
        officeManager = configuration.buildOfficeManager();  
        officeManager.start();    //启动服务  
        System.out.println("office转换服务启动成功!");
    } catch (Exception ce) {  
        System.out.println("office转换服务启动失败!详细信息:" + ce);  
    }  
}
 
Example 5
Source File: Doc2DocxUtil.java    From sun-wordtable-read with Apache License 2.0 5 votes vote down vote up
public static void startService(){  
    DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();  
    try {  
        configuration.setOfficeHome(OPEN_OFFICE_HOME);//设置安装目录  
        configuration.setPortNumbers(OPEN_OFFICE_PORT); //设置端口  
        configuration.setTaskExecutionTimeout(1000 * 60 * 5L);  
        configuration.setTaskQueueTimeout(1000 * 60 * 60 * 24L);  
        officeManager = configuration.buildOfficeManager();  
        officeManager.start();    //启动服务  
    } catch (Exception ce) {  
        System.out.println("office转换服务启动失败!详细信息:" + ce);  
    }  
}
 
Example 6
Source File: OfficeDocumentConvertServer.java    From sun-wordtable-read with Apache License 2.0 5 votes vote down vote up
private void startService(String officeHome, int... ports) {
	DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();
	try {
		System.out.println("准备启动office服务....");
		configuration.setOfficeHome(officeHome);// 设置安装目录
		configuration.setPortNumbers(ports); // 设置端口
		configuration.setTaskExecutionTimeout(1000 * 60 * 5L);
		configuration.setTaskQueueTimeout(1000 * 60 * 60 * 24L);
		officeManager = configuration.buildOfficeManager();
		officeManager.start(); // 启动服务
		System.out.println("office转换服务启动成功!");
	} catch (Exception ce) {
		System.out.println("office转换服务启动失败!详细信息:" + ce);
	}
}
 
Example 7
Source File: ViewOfficeTools.java    From csustRepo with MIT License 5 votes vote down vote up
public synchronized OfficeManager newOfficeManager() {
	String officehome=ServletActionContext.getServletContext().getInitParameter("officehome");
	int portnumbers=Integer.parseInt(ServletActionContext.getServletContext().getInitParameter("portnumbers"));

	DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();
	configuration.setOfficeHome(officehome);//设置OpenOffice.org安装目录
	configuration.setPortNumbers(portnumbers); //设置转换端口,默认为8100
	configuration.setTaskExecutionTimeout(1000 * 60 * 10L);//设置任务执行超时为5分钟
	configuration.setTaskQueueTimeout(1000 * 60 * 60 * 24L);//设置任务队列超时为24小时
	
	return configuration.buildOfficeManager();
}
 
Example 8
Source File: ContextListener.java    From csustRepo with MIT License 5 votes vote down vote up
private void initViewOfficeTools(ServletContextEvent sce){

		String officehome=sce.getServletContext().getInitParameter("officehome");
		int portnumbers=Integer.parseInt(sce.getServletContext().getInitParameter("portnumbers"));

		DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();
		configuration.setOfficeHome(officehome);//设置OpenOffice.org安装目录
		configuration.setPortNumbers(portnumbers); //设置转换端口,默认为8100
		configuration.setTaskExecutionTimeout(1000 * 60 * 10L);//设置任务执行超时为5分钟
		configuration.setTaskQueueTimeout(1000 * 60 * 60 * 24L);//设置任务队列超时为24小时

		OfficeManager officeManager=configuration.buildOfficeManager();
		officeManager.start();
		ViewOfficeTools.newInstance().setOfficeManager(officeManager);
	}