当前位置: 首页 > news >正文

中国建设工程安全协会网站2021年最新热点素材

中国建设工程安全协会网站,2021年最新热点素材,公司一般都用什么邮箱,wordpress tar.xz使用Openoffice或LibreOffice实现World、Excel、PPTX在线预览 预览方案使用第三方服务使用前端库转换格式 jodconverterjodconverter概述主要特性OpenOfficeLibreOffice jodconverter的基本使用添加依赖配置创建DocumentConverter实例上传与转换预览启动上传与预览World 与Spri… 使用Openoffice或LibreOffice实现World、Excel、PPTX在线预览 预览方案使用第三方服务使用前端库转换格式 jodconverterjodconverter概述主要特性OpenOfficeLibreOffice jodconverter的基本使用添加依赖配置创建DocumentConverter实例上传与转换预览启动上传与预览World 与Spring Boot集成添加依赖项配置JodConverter和LibreOffice启动对比预览 ExcelPPTX预览 预览方案 使用第三方服务 有三方服务提供了在线预览文档的功能可以将文件上传到这些服务然后嵌入其提供的预览组件到你的网页中。常用的服务包括 Google Docs、Microsoft Office Online 和 Adobe Document Cloud。 1.调用微软的在线预览功能实现 iframe srchttps://view.officeapps.live.com/op/view.aspx?srcfileurl width100% height100% frameborder1/iframe2.调用google的文档在线预览实现 iframe :srchttps://docs.google.com/viewer?urlfileurl/iframe 3.调用XDOC文档预览服务 XDOC文档预览服务https://view.xdocin.com/ XDOC还可以实现文本、带参数文本、html文本、json文本、公文等在线预览具体实现方法请看官方文档 注意预览资源必须是公共可访问的 使用前端库 使用一些前端库来实现文档的在线预览。例如对于Word文档和Excel文件可以使用mammoth.js或xlsx.js库来解析和渲染文件内容。对于 PDF 文件可以使用pdf.js库来渲染和显示PDF内容。 worldhttps://github.com/mwilliamson/mammoth.js excelhttps://github.com/qax-os/excelize、https://github.com/tealeg/xlsx pdfhttps://github.com/mozilla/pdf.js 转换格式 将文档转换为特定格式然后在网页中显示。例如将Word、Excel、PDF转换成PDF、HTML、图片进行预览。 可以使用jodconverter它是一个强大的文档转换工具适用于需要将Office文档转换为其他格式的应用程序。 jodconverter jodconverter概述 jodconverter是一个开源项目用于将 Office 文档如 Word、Excel、PowerPoint 等转换为其他格式例如 PDF、HTML、图像等。它基于 Java 平台并使用 LibreOffice/OpenOffice 作为转换引擎。 jodconverter 提供了简单易用的 API使开发人员能够在自己的应用程序中集成文档转换功能。它可以与 Java 应用程序一起使用也可以通过 REST API 进行远程调用。 Githubhttps://github.com/jodconverter/jodconverter 主要特性 文档转换jodconverter 可以将各种 Office 文档格式如 DOCX、XLSX、PPTX 等转换为其他格式如 PDF、HTML、图像PNG、JPEG 等等。批量转换你可以使用 jodconverter 批量转换多个文档提高转换效率。异步转换jodconverter 支持异步转换可以在后台进行文档转换不会阻塞主线程。自定义配置你可以根据需要配置转换过程中的参数如输出格式、图像质量、页面大小等。监听器支持jodconverter 提供了监听器接口可以在转换过程中监听转换状态和进度。多平台支持jodconverter 可以在多个平台上运行包括 Windows、Linux 和 macOS。OpenOffice jodconverter依赖于Apache OpenOffice或LibreOffice,在使用jodconverter之前需要先安装二者其一 Apache OpenOffice是一款免费的开源办公软件套件包含了文本编辑器、电子表格、演示文稿、图形处理和数据库管理等多种功能。它由Apache软件基金会开发和维护支持跨平台可以在Windows、Mac和Linux等操作系统上运行。Apache OpenOffice与Microsoft Office相似可用于创建、编辑和共享各种文档、报告和电子邮件等内容。 openoffice下载http://www.openoffice.org/download/index.html LibreOffice jodconverter依赖于Apache OpenOffice或LibreOffice,在使用jodconverter之前需要先安装二者其一 LibreOffice是一款免费的开源办公套件它包括文本编辑器、电子表格、演示文稿、绘图和数据库管理工具等多个组件可以用于处理各种常见的办公任务。LibreOffice由The Document Foundation开发是OpenOffice.org的一个分支其源代码是完全开放的并且提供了对多种操作系统的支持包括Windows、Mac OS X和Linux等。 libreofficehttps://www.libreoffice.org/download/download-libreoffice/ jodconverter的基本使用 添加依赖 !-- 核心包 --dependencygroupIdorg.jodconverter/groupIdartifactIdjodconverter-core/artifactIdversion4.4.6/version/dependency!-- 本地支持包 --dependencygroupIdorg.jodconverter/groupIdartifactIdjodconverter-local/artifactIdversion4.4.6/version/dependency配置 jodconverter:local:# libreOffice根目录 # office-home: D:\LibreOffice# OpenOffice安装地址office-home: D:\OpenOffice 4# 同时执行任务的个数,最大进程数max-tasks-per-process: 2# 开启多个进程每个端口对应一个进程;设置端口号任意设置port-numbers: 3000,3001# 一个进程的超时时间process-timeout: 120000创建DocumentConverter实例 import lombok.extern.slf4j.Slf4j; import org.jodconverter.core.DocumentConverter; import org.jodconverter.core.office.InstalledOfficeManagerHolder; import org.jodconverter.core.office.OfficeException; import org.jodconverter.core.office.OfficeManager; import org.jodconverter.core.office.OfficeUtils; import org.jodconverter.local.LocalConverter; import org.jodconverter.local.office.LocalOfficeManager; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component;import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import java.util.Arrays;Slf4j Component Order(Ordered.HIGHEST_PRECEDENCE) public class ConverterConfiguration {private LocalOfficeManager officeManager;Value(${jodconverter.local.office-home})private String officeHome;Value(${jodconverter.local.port-numbers})private String portNumber;Value(${jodconverter.local.max-tasks-per-process})private Integer maxTaskPerProcess;Value(${jodconverter.local.process-timeout})private Long processTimeout;/*** 启动Office组件进程** return*/PostConstructpublic OfficeManager officeManager() {// 多个端口处理String[] portsString portNumber.split(,);int[] ports Arrays.stream(portsString).mapToInt(Integer::parseInt).toArray();// 系统判断String os System.getProperty(os.name).toLowerCase();officeManager LocalOfficeManager.builder().officeHome(os.contains(windows) ? officeHome : linuxHome).portNumbers(ports).processTimeout(processTimeout).maxTasksPerProcess(maxTaskPerProcess).install().build();try {officeManager.start();InstalledOfficeManagerHolder.setInstance(officeManager);log.info(office进程启动成功);} catch (OfficeException e) {log.error(启动office组件失败);throw new RuntimeException(e);}return officeManager;}/*** 创建DocumentConverter实例** return*/Beanpublic DocumentConverter documentConverter() {log.info(创建DocumentConverter实例);LocalConverter converter LocalConverter.builder().officeManager(officeManager).build();return converter;}PreDestroypublic void destroyOfficeManager() {if (null ! officeManager officeManager.isRunning()) {log.info(终止office进程);OfficeUtils.stopQuietly(officeManager);}}} 上传与转换 import org.jodconverter.DocumentConverter; import org.jodconverter.document.DefaultDocumentFormatRegistry; import org.jodconverter.office.OfficeException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile;import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.UUID;RestController public class FileController {/*** 上传与预览的测试目录*/public static String PATH D://test//;/*** 转换器*/Autowiredprivate DocumentConverter documentConverter;GetMapping(/test)public String test() {return OK;}PostMapping(/upload)public String handleFileUpload(RequestParam(file) MultipartFile file) throws OfficeException {if (file.isEmpty()) {return 请选择上传文件;}// 保存上传文件File localFile new File(PATH file.getOriginalFilename());try (OutputStream os new FileOutputStream(localFile)) {os.write(file.getBytes());} catch (IOException e) {e.printStackTrace();}// 转换成pdf的名称String pdfName UUID.randomUUID().toString().replace(-, );// 转换成pdf存放路径File pdfFile new File(PATH pdfName .pdf);// 开始转换documentConverter.convert(localFile).as(doc.equals(DefaultDocumentFormatRegistry.DOC.getExtension()) ? DefaultDocumentFormatRegistry.DOC : DefaultDocumentFormatRegistry.DOCX).to(pdfFile).as(DefaultDocumentFormatRegistry.PDF).execute();// 返回转换后的pdf文件的URLString previewUrl http://localhost:8888/preview/ pdfName;return a href previewUrl target_blankPreview/a;} }预览 import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController;import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; import java.nio.file.Files;RestController public class PreviewController {GetMapping(/preview/{fileName})public void showPreview(PathVariable String fileName, HttpServletResponse response) throws IOException {File file new File(FileController.PATH fileName .pdf);response.setContentType(application/pdf);response.setHeader(Content-Disposition, inline; filename fileName);response.setHeader(Content-Length, String.valueOf(file.length()));Files.copy(file.toPath(), response.getOutputStream());} }启动 OpenOffice启动日志 INFO 25076 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8888 (http) INFO 25076 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] INFO 25076 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.41] INFO 25076 --- [ restartedMain] o.a.catalina.core.AprLifecycleListener : Loaded Apache Tomcat Native library [1.2.31] using APR version [1.7.0]. INFO 25076 --- [ restartedMain] o.a.catalina.core.AprLifecycleListener : APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. INFO 25076 --- [ restartedMain] o.a.catalina.core.AprLifecycleListener : APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true] INFO 25076 --- [ restartedMain] o.a.catalina.core.AprLifecycleListener : OpenSSL successfully initialized [OpenSSL 1.1.1l 24 Aug 2021] INFO 25076 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext INFO 25076 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2235 ms INFO 25076 --- [ restartedMain] c.y.demo.config.ConverterConfiguration : office进程启动成功 INFO 25076 --- [er-offprocmng-0] o.j.local.office.OfficeDescriptor : soffice info (from exec path): Product: OpenOffice - Version: ??? - useLongOptionNameGnuStyle: false INFO 25076 --- [er-offprocmng-1] o.j.local.office.OfficeDescriptor : soffice info (from exec path): Product: OpenOffice - Version: ??? - useLongOptionNameGnuStyle: false INFO 25076 --- [ restartedMain] c.y.demo.config.ConverterConfiguration : 创建DocumentConverter实例 INFO 25076 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService applicationTaskExecutor INFO 25076 --- [ restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index INFO 25076 --- [er-offprocmng-0] o.j.l.office.LocalOfficeProcessManager : Starting process with --accept socket,host127.0.0.1,port3000,tcpNoDelay1;urp;StarOffice.ServiceManager and profileDir C:\Users\Admin\AppData\Local\Temp\.jodconverter_socket_host-127.0.0.1_port-3000_tcpNoDelay-1 INFO 25076 --- [er-offprocmng-1] o.j.l.office.LocalOfficeProcessManager : Starting process with --accept socket,host127.0.0.1,port3001,tcpNoDelay1;urp;StarOffice.ServiceManager and profileDir C:\Users\Admin\AppData\Local\Temp\.jodconverter_socket_host-127.0.0.1_port-3001_tcpNoDelay-1 Loading class com.mysql.jdbc.Driver. This is deprecated. The new driver class is com.mysql.cj.jdbc.Driver. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. INFO 25076 --- [er-offprocmng-0] o.j.local.office.OfficeConnection : Connected: socket,host127.0.0.1,port3000,tcpNoDelay1 INFO 25076 --- [er-offprocmng-0] o.j.l.office.LocalOfficeProcessManager : Started process; pid: 27528 INFO 25076 --- [er-offprocmng-1] o.j.local.office.OfficeConnection : Connected: socket,host127.0.0.1,port3001,tcpNoDelay1 INFO 25076 --- [er-offprocmng-1] o.j.l.office.LocalOfficeProcessManager : Started process; pid: 20444 INFO 25076 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 INFO 25076 --- [ restartedMain] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path /actuator INFO 25076 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8888 (http) with context path INFO 25076 --- [ restartedMain] cn.ybzy.demo.Application : Started Application in 6.576 seconds (JVM running for 8.362) INFO 25076 --- [1)-192.168.56.1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... WARN 25076 --- [1)-192.168.56.1] com.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassNamecom.mysql.jdbc.Driver was not found, trying direct instantiation. INFO 25076 --- [1)-192.168.56.1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. INFO 25076 --- [3)-192.168.56.1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet dispatcherServlet INFO 25076 --- [3)-192.168.56.1] o.s.web.servlet.DispatcherServlet : Initializing Servlet dispatcherServlet INFO 25076 --- [3)-192.168.56.1] o.s.web.servlet.DispatcherServlet : Completed initialization in 9 ms INFO 25076 --- [ter-poolentry-2] o.j.local.task.LocalConversionTask : Executing local conversion task [doc - pdf]...LibreOffice启动日志 5728 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8888 (http) 25728 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] 5728 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.41] NFO 5728 --- [ restartedMain] o.a.catalina.core.AprLifecycleListener : Loaded Apache Tomcat Native library [1.2.31] using APR version [1.7.0].INFO 5728 --- [ restartedMain] o.a.catalina.core.AprLifecycleListener : APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].INFO 5728 --- [ restartedMain] o.a.catalina.core.AprLifecycleListener : APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]INFO 5728 --- [ restartedMain] o.a.catalina.core.AprLifecycleListener : OpenSSL successfully initialized [OpenSSL 1.1.1l 24 Aug 2021]INFO 5728 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContextINFO 5728 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2260 msINFO 5728 --- [ restartedMain] c.y.demo.config.ConverterConfiguration : office进程启动成功INFO 5728 --- [er-offprocmng-0] o.j.local.office.OfficeDescriptor : soffice info (from exec path): Product: LibreOffice - Version: ??? - useLongOptionNameGnuStyle: true INFO 5728 --- [er-offprocmng-1] o.j.local.office.OfficeDescriptor : soffice info (from exec path): Product: LibreOffice - Version: ??? - useLongOptionNameGnuStyle: true INFO 5728 --- [ restartedMain] c.y.demo.config.ConverterConfiguration : 创建DocumentConverter实例 INFO 5728 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService applicationTaskExecutor INFO 5728 --- [ restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index INFO 5728 --- [er-offprocmng-1] o.j.l.office.LocalOfficeProcessManager : Starting process with --accept socket,host127.0.0.1,port3001,tcpNoDelay1;urp;StarOffice.ServiceManager and profileDir C:\Users\Admin\AppData\Local\Temp\.jodconverter_socket_host-127.0.0.1_port-3001_tcpNoDelay-1 INFO 5728 --- [er-offprocmng-0] o.j.l.office.LocalOfficeProcessManager : Starting process with --accept socket,host127.0.0.1,port3000,tcpNoDelay1;urp;StarOffice.ServiceManager and profileDir C:\Users\Admin\AppData\Local\Temp\.jodconverter_socket_host-127.0.0.1_port-3000_tcpNoDelay-1 Loading class com.mysql.jdbc.Driver. This is deprecated. The new driver class is com.mysql.cj.jdbc.Driver. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. INFO 5728 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 INFO 5728 --- [ restartedMain] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path /actuator INFO 5728 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8888 (http) with context path INFO 5728 --- [ restartedMain] cn.ybzy.demo.Application : Started Application in 6.968 seconds (JVM running for 8.97) INFO 5728 --- [1)-192.168.56.1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet dispatcherServlet INFO 5728 --- [1)-192.168.56.1] o.s.web.servlet.DispatcherServlet : Initializing Servlet dispatcherServlet INFO 5728 --- [2)-192.168.56.1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... WARN 5728 --- [2)-192.168.56.1] com.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassNamecom.mysql.jdbc.Driver was not found, trying direct instantiation. INFO 5728 --- [1)-192.168.56.1] o.s.web.servlet.DispatcherServlet : Completed initialization in 10 ms INFO 5728 --- [2)-192.168.56.1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. INFO 5728 --- [er-offprocmng-1] o.j.local.office.OfficeConnection : Connected: socket,host127.0.0.1,port3001,tcpNoDelay1 INFO 5728 --- [er-offprocmng-1] o.j.l.office.LocalOfficeProcessManager : Started process; pid: 29060 INFO 5728 --- [er-offprocmng-0] o.j.local.office.OfficeConnection : Connected: socket,host127.0.0.1,port3000,tcpNoDelay1 INFO 5728 --- [er-offprocmng-0] o.j.l.office.LocalOfficeProcessManager : Started process; pid: 16476 INFO 5728 --- [ter-poolentry-2] o.j.local.task.LocalConversionTask : Executing local conversion task [doc - pdf]...上传与预览World 与Spring Boot集成 添加依赖项 !-- 核心包 --dependencygroupIdorg.jodconverter/groupIdartifactIdjodconverter-core/artifactIdversion4.2.2/version/dependency!-- 本地支持包 --dependencygroupIdorg.jodconverter/groupIdartifactIdjodconverter-local/artifactIdversion4.2.2/version/dependency!-- springboot支持包括自动配置类 --dependencygroupIdorg.jodconverter/groupIdartifactIdjodconverter-spring-boot-starter/artifactIdversion4.2.2/version/dependency配置JodConverter和LibreOffice 通过在应用程序的配置文件中添加以下属性来配置JodConverter和LibreOffice jodconverter:local:enabled: true# libreOffice根目录office-home: D:\LibreOffice# OpenOffice安装地址# office-home: D:\OpenOffice 4# 同时执行任务的个数,最大进程数max-tasks-per-process: 2# 开启多个进程每个端口对应一个进程;设置端口号任意设置port-numbers: 3000# 任务执行的超时时间taskExecutionTimeout: 120000# 任务队列的超时时间taskQueueTimeout: 30000# 一个进程的超时时间process-timeout: 120000启动对比 使用Openoffice INFO 17640 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8888 (http) INFO 17640 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] INFO 17640 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.41] INFO 17640 --- [ restartedMain] o.a.catalina.core.AprLifecycleListener : Loaded Apache Tomcat Native library [1.2.31] using APR version [1.7.0]. INFO 17640 --- [ restartedMain] o.a.catalina.core.AprLifecycleListener : APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. INFO 17640 --- [ restartedMain] o.a.catalina.core.AprLifecycleListener : APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true] INFO 17640 --- [ restartedMain] o.a.catalina.core.AprLifecycleListener : OpenSSL successfully initialized [OpenSSL 1.1.1l 24 Aug 2021] INFO 17640 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext INFO 17640 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 5223 ms INFO 17640 --- [ restartedMain] o.j.office.OfficeProcessManager : Submitting task Start and waiting... INFO 17640 --- [ProcessThread-0] o.jodconverter.office.OfficeDescriptor : soffice info (from exec path): Product: OpenOffice - Version: ??? - useLongOptionNameGnuStyle: false INFO 17640 --- [ProcessThread-0] org.jodconverter.office.OfficeProcess : Starting process with acceptString socket,host127.0.0.1,port3000,tcpNoDelay1;urp;StarOffice.ServiceManager and profileDir C:\Users\Admin\AppData\Local\Temp\.jodconverter_socket_host-127.0.0.1_port-3000_tcpNoDelay-1 INFO 17640 --- [ProcessThread-0] org.jodconverter.office.OfficeProcess : Started process; pid 19960 INFO 17640 --- [ProcessThread-0] o.jodconverter.office.OfficeConnection : Connected: socket,host127.0.0.1,port3000,tcpNoDelay1 INFO 17640 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService applicationTaskExecutor INFO 17640 --- [ restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index Loading class com.mysql.jdbc.Driver. This is deprecated. The new driver class is com.mysql.cj.jdbc.Driver. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. INFO 17640 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 INFO 17640 --- [ restartedMain] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path /actuator INFO 17640 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8888 (http) with context path INFO 17640 --- [ restartedMain] cn.ybzy.demo.Application : Started Application in 12.67 seconds (JVM running for 16.446) INFO 17640 --- [2)-192.168.56.1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet dispatcherServlet INFO 17640 --- [2)-192.168.56.1] o.s.web.servlet.DispatcherServlet : Initializing Servlet dispatcherServlet INFO 17640 --- [1)-192.168.56.1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... WARN 17640 --- [1)-192.168.56.1] com.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassNamecom.mysql.jdbc.Driver was not found, trying direct instantiation. INFO 17640 --- [2)-192.168.56.1] o.s.web.servlet.DispatcherServlet : Completed initialization in 16 ms INFO 17640 --- [1)-192.168.56.1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. INFO 17640 --- [agerPoolEntry-1] o.jodconverter.task.LocalConversionTask : Executing local conversion task... 使用LibreOffice INFO 13756 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8888 (http) INFO 13756 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] INFO 13756 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.41] INFO 13756 --- [ restartedMain] o.a.catalina.core.AprLifecycleListener : Loaded Apache Tomcat Native library [1.2.31] using APR version [1.7.0]. INFO 13756 --- [ restartedMain] o.a.catalina.core.AprLifecycleListener : APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. INFO 13756 --- [ restartedMain] o.a.catalina.core.AprLifecycleListener : APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true] INFO 13756 --- [ restartedMain] o.a.catalina.core.AprLifecycleListener : OpenSSL successfully initialized [OpenSSL 1.1.1l 24 Aug 2021] INFO 13756 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext INFO 13756 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2312 ms INFO 13756 --- [ restartedMain] o.j.office.OfficeProcessManager : Submitting task Start and waiting... INFO 13756 --- [ProcessThread-0] o.jodconverter.office.OfficeDescriptor : soffice info (from exec path): Product: LibreOffice - Version: ??? - useLongOptionNameGnuStyle: true INFO 13756 --- [ProcessThread-0] org.jodconverter.office.OfficeProcess : Starting process with acceptString socket,host127.0.0.1,port3000,tcpNoDelay1;urp;StarOffice.ServiceManager and profileDir C:\Users\Admin\AppData\Local\Temp\.jodconverter_socket_host-127.0.0.1_port-3000_tcpNoDelay-1 INFO 13756 --- [ProcessThread-0] org.jodconverter.office.OfficeProcess : Started process; pid 3216 INFO 13756 --- [ProcessThread-0] o.jodconverter.office.OfficeConnection : Connected: socket,host127.0.0.1,port3000,tcpNoDelay1 INFO 13756 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService applicationTaskExecutor INFO 13756 --- [ restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index Loading class com.mysql.jdbc.Driver. This is deprecated. The new driver class is com.mysql.cj.jdbc.Driver. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. INFO 13756 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 INFO 13756 --- [ restartedMain] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path /actuator INFO 13756 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8888 (http) with context path INFO 13756 --- [ restartedMain] cn.ybzy.demo.Application : Started Application in 21.748 seconds (JVM running for 23.568) INFO 13756 --- [1)-192.168.56.1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet dispatcherServlet INFO 13756 --- [1)-192.168.56.1] o.s.web.servlet.DispatcherServlet : Initializing Servlet dispatcherServlet INFO 13756 --- [2)-192.168.56.1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... WARN 13756 --- [2)-192.168.56.1] com.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassNamecom.mysql.jdbc.Driver was not found, trying direct instantiation. INFO 13756 --- [1)-192.168.56.1] o.s.web.servlet.DispatcherServlet : Completed initialization in 10 ms INFO 13756 --- [2)-192.168.56.1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. INFO 13756 --- [agerPoolEntry-1] o.jodconverter.task.LocalConversionTask : Executing local conversion task...经测试发现: 使用Openoffice启动速度更快 预览 Excel 可以将Excel转成PDF或者HTML格式进行预览通常来说转成HTML格式更好这里仅作为调试转换成PDF RestController public class FileController {/*** 上传与预览的测试目录*/public static String PATH D://test//;Autowiredprivate DocumentConverter documentConverter;GetMapping(/test)public String test() {return OK;}PostMapping(/upload)public String handleFileUpload(RequestParam(file) MultipartFile file) throws OfficeException, IOException {if (file.isEmpty()) {return 请选择上传文件;}// 保存上传文件File localFile new File(PATH file.getOriginalFilename());FileUtils.writeByteArrayToFile(localFile, file.getBytes());// 转换成pdf的名称String pdfName UUID.randomUUID().toString().replace(-, );// 转换成pdf存放路径File pdfFile new File(PATH pdfName .pdf);// 开始转换documentConverter.convert(localFile).to(pdfFile).execute();// 返回转换后的pdf文件的URLString previewUrl http://localhost:8888/preview/ pdfName;return a href previewUrl target_blankPreview/a;} } NFO 24048 --- [er-offprocmng-0] o.j.local.office.OfficeConnection : Connected: socket,host127.0.0.1,port3000,tcpNoDelay1 INFO 24048 --- [er-offprocmng-0] o.j.l.office.LocalOfficeProcessManager : Started process; pid: 9896 INFO 24048 --- [ter-poolentry-1] o.j.local.task.LocalConversionTask : Executing local conversion task [xlsx - pdf]...PPTX预览 PostMapping(/upload)public String handleFileUpload(RequestParam(file) MultipartFile file) throws OfficeException, IOException {if (file.isEmpty()) {return 请选择上传文件;}// 保存上传文件File localFile new File(PATH file.getOriginalFilename());FileUtils.writeByteArrayToFile(localFile, file.getBytes());// 转换成pdf的名称String pdfName UUID.randomUUID().toString().replace(-, );// 转换成pdf存放路径File pdfFile new File(PATH pdfName .pdf);// 开始转换documentConverter.convert(localFile).to(pdfFile).execute();// 返回转换后的pdf文件的URLString previewUrl http://localhost:8888/preview/ pdfName;return previewUrl;}INFO 24048 --- [er-offprocmng-0] o.j.local.office.OfficeConnection : Connected: socket,host127.0.0.1,port3000,tcpNoDelay1 INFO 24048 --- [er-offprocmng-0] o.j.l.office.LocalOfficeProcessManager : Started process; pid: 16724 INFO 24048 --- [ter-poolentry-1] o.j.local.task.LocalConversionTask : Executing local conversion task [pptx - pdf]...
http://www.zqtcl.cn/news/160154/

相关文章:

  • 网站建设与管理2018海尔集团网站 建设目的
  • ps做网站大小wordpress调用 php文件
  • php网站忘记后台密码江苏网页制作报价
  • 网站模板 哪个好完备的常州网站推广
  • 衡水淘宝的网站建设濮阳市城乡一体化示范区主任
  • 公司网上注册在哪个网站商洛市商南县城乡建设局网站
  • 怎么才能让网站图文展示大连网站建设设计
  • 俱乐部网站 模板seo产品是什么意思
  • 新手学做网站的教学书建造师查询官网
  • win2012 iis添加网站群辉做网站服务器
  • 网站优化课程培训山东网站备案公司
  • top wang域名做网站好事业单位门户网站建设评价
  • 有什么网站可以做简历网站备案表格
  • 网站开发用什么图片格式最好厦门人才网个人会员
  • 关于网站开发的文献深圳网络推广代运营
  • 网站做app的重要性做静态网站有什么用
  • 一键搭建网站系统教做衣服的网站有哪些
  • 城乡建设部网站施工员证书查询中铁建设集团有限公司招标平台
  • 广东省建设项目安全标准自评网站哪个网站可以免费做简历
  • 带产品展示的个人网站模板购物网站开发背景
  • 哪个域名注册网站好seo广告投放是什么意思
  • 网站建设ydwzjs电子邮箱怎么申请
  • 福建省建住房建设部网站wordpress 算数验证码
  • 东莞企业如何建网站网站正在建设中...为什么护卫神
  • 引流用的电影网站怎么做wordpress浏览速度
  • 微信小程序怎拼做搬家网站东莞建网站公司
  • 网站推广昔年下拉博客推广链接制作软件
  • php 小企业网站 cmswordpress导航分类
  • 婚恋网站女孩子都是做美容免费空间最大的网盘
  • 建立网站要钱吗找人做网站需求怎么写