栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

libreoffice在liunx和uos国产化上面的部署

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

libreoffice在liunx和uos国产化上面的部署

       

目录

       

在liunx上安装libreoffice

 在国产化UOS系统上安装libreoffice

使用springboot集成libreoffice                                                        


在liunx上安装libreoffice
  1. 登陆网址:下载 LibreOffice | LibreOffice 简体中文官方网站 - 自由免费的办公套件 下载对应版本的libreoffice                                                                                                                                                                                                                   
  2.  卸载liunx环境残留文件(可选项)                                                                                             
    yum remove libreoffice-*
  3. 将下载好的linux版本的文件上传至服务器的某个目录,然后解压文件                                       
    tar -zxvf LibreOffice_7.2.2_Linux_x86-64_rpm.tar.gz
  4.  上面的文件解压之后会产生一个RPMS文件,使用以下命令进入到RPMS目录并进行安装       
      cd /LibreOffice_7.0.3_Linux_x86-64_rpm/RPMS
           yum localinstall *.rpm
  5.  安装libreoffice-headless(安装这个东西,需要java环境,可以先安装一下java环境)        
    yum install libreoffice-headless
  6.  判断libreoffice是否安装成功                                                                                              
 libreoffice --convert-to pdf:writer_pdf_Export /server/libreoffice/查询sql优化.txt --outdir /server/libreoffice/
	   注意:此处libreoffice安装你装的版本来执行相应的命令,例如你安装的是7.2.2 那可能执行的命里如下:
	   libreoffice7.1 --convert-to pdf:writer_pdf_Export /server/libreoffice/11.txt --outdir /server/libreoffice

 在国产化UOS系统上安装libreoffice

 

  1. 在电脑的应用商店找到libreoffice,并安装;                                                                             
  2. 安装后直接点开libreOffice;
  3. 如果uos系统 打开LibreOffice 提示访问权限不足;                                                                     
    在控制台使用:sudo rm /home/dag/.config/libreoffice –rf

判断libreoffice是否安装成功                                                                                                     

libreoffice --convert-to pdf:writer_pdf_Export /server/libreoffice/查询sql优化.txt --outdir /server/libreoffice/

使用springboot集成libreoffice                                                        
  1.  在pom.xml中引入对应jar包                                                                                                      
    
                org.jodconverter
                jodconverter-spring-boot-starter
                4.2.2
            
            
                org.jodconverter
                jodconverter-local
                4.2.2
            
            
                org.jodconverter
                jodconverter-core
                4.2.2
            
            
                org.libreoffice
                ridl
                6.4.0
            
  2. 在.properties文件中配置相关配置                                                                                            
    # 设置LibreOffice主目录
    #生产环境地址
    #jodconverter.local.office-home=/opt/libreoffice7.1
    #本地地址
    jodconverter.local.office-home=C:/Program Files/LibreOffice
    # 开启多个LibreOffice进程,每个端口对应一个进程
    jodconverter.local.portNumbers=8100
    # LibreOffice进程重启前的最大进程数
    jodconverter.local.maxTasksPerProcess=100
  3.  编写测试方法                                                                                                                             
    @Test
        public void test1() throws Exception {
            File sourceFile=new File("D:\server\minio操作文档.txt");
            File targetFile=new File("D:\server\minio操作文档.pdf");
            // 转换pdf文件
            documentConverter.convert(sourceFile).to(targetFile).execute();
            System.out.println("=====输出日志====");
        }

 

 

 

 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/341532.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号