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

做中英双语切换的网站谷歌浏览器搜索入口

做中英双语切换的网站,谷歌浏览器搜索入口,wordpress会员破解,十堰微网站建设文章目录 概要整体介绍具体实现官网pom文件增加依赖 遇到的问题本地运行OK,发布到Linux报错还是本地OK,但是Linux能运行的,但是中文乱码 小结 概要 Springboot word 转 pdf 整体介绍 搜了一下,发现了能实现功能的方法有四种 U…

文章目录

    • 概要
    • 整体介绍
    • 具体实现
      • 官网
        • pom文件增加依赖
    • 遇到的问题
      • 本地运行OK,发布到Linux报错
      • 还是本地OK,但是Linux能运行的,但是中文乱码
    • 小结

概要

Springboot word 转 pdf

整体介绍

搜了一下,发现了能实现功能的方法有四种

  1. Using itext and opensagres and apache poi
  2. Using Documents4j
  3. Using openoffice nuoil
  4. Using Aspose Word(not free)

具体实现

这里只提供Aspose的实现,因为这个不区分windows还是Linux操作系统。因为试过了,Doc4j需要依赖是Windows的,所以暂时不去研究了

官网

aspose官网

由于是收费的,所以这里的就按照官网的来,百度一搜随便都是jar包。我这里不贴了,毕竟不是免费的,可以自行搜索破解版。
不废话了,上代码
代码很简单的,这里写一个直接写文件的例子

创建一个springboot项目,然后把下载下来的jar包放到resource的lib下
在这里插入图片描述
然后右键这个jar包,然后点击Add as library,点击完了才是截图这样的,否则就只是一个jar包,点击了Add as library目的是为了让项目引入这个jar包。

pom文件增加依赖
<dependency><groupId>com.aspose.words</groupId><artifactId>aspose-words</artifactId><version>19.3</version><scope>system</scope><systemPath>${project.basedir}/src/main/resources/lib/aspose-words-19.3.jar</systemPath>
</dependency>
package com.word2pdf.springbootword2pdf.controller;import com.aspose.words.Document;
import com.aspose.words.ParagraphFormat;
import com.aspose.words.SaveFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;/*** word2pdf** @author Rex* @since 2024/4/12 11:34*/
@RestController
@RequestMapping("/pangolin/test")
public class TestController {@GetMapping("/word2pdf")public String test() throws Exception {InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("word/response.docx");Document doc = new Document(inputStream);ParagraphFormat pf=doc.getStyles().getDefaultParagraphFormat();pf.clearFormatting();File tempPdfFile = new File("./temp.pdf");FileOutputStream os = new FileOutputStream(tempPdfFile);doc.save(os, SaveFormat.PDF);return "1";}}

遇到的问题

本地运行OK,发布到Linux报错

第一个坎儿,报错没有找到类

java.lang.ClassNotFoundException: com.aspose.words.Document

在这里插入图片描述
这个是因为不是走的maven,自己放在项目的resources的lib下,本地运行可以的,但是打包需要在pom里增加配置

<build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><!--打包的时候包含资源文件夹下自己的jar包--><includeSystemScope>true</includeSystemScope><excludes><exclude><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></exclude></excludes></configuration></plugin></plugins>
</build>

这个为了打包的时候能给这个jar包包含进来。

还是本地OK,但是Linux能运行的,但是中文乱码

好一个中文乱码,这个问题是因为毕竟doc是基于windows的,所以这里是少字体包。
解决方式是,简单来说就是把windows的字体包拷贝到Linux中,然后安装即可

# 首先windows 字体库的路径 : C:\Windows\Fonts
# 在/usr/share/fonts/下新建文件夹 winFonts
cd /usr/share/fonts/winFonts
sudo mkfontscale
sudo mkfontdir //这两条命令是生成字体的索引信息
sudo fc-cache -fv //更新字体缓存

到此问题解决,还是需要有耐心,分析问题,解决问题,当然了也离不开运维同事的配合。

小结

遇到问题了先不要慌,冷静分析,相信自己能行。

附例子代码


文章转载自:
http://hydrokinetic.xhqr.cn
http://pontil.xhqr.cn
http://mi.xhqr.cn
http://landtied.xhqr.cn
http://hygrometry.xhqr.cn
http://flexility.xhqr.cn
http://choreographer.xhqr.cn
http://hemocytoblastic.xhqr.cn
http://dextrane.xhqr.cn
http://legate.xhqr.cn
http://detritivorous.xhqr.cn
http://decentralisation.xhqr.cn
http://unhidden.xhqr.cn
http://collaret.xhqr.cn
http://peiraeus.xhqr.cn
http://pollakiuria.xhqr.cn
http://sown.xhqr.cn
http://tenpenny.xhqr.cn
http://contributing.xhqr.cn
http://clc.xhqr.cn
http://skinhead.xhqr.cn
http://fireballer.xhqr.cn
http://skyjack.xhqr.cn
http://bridgetown.xhqr.cn
http://infinitesimal.xhqr.cn
http://opal.xhqr.cn
http://heterostructure.xhqr.cn
http://departmentalize.xhqr.cn
http://sephardic.xhqr.cn
http://explainable.xhqr.cn
http://consensus.xhqr.cn
http://taedong.xhqr.cn
http://batwoman.xhqr.cn
http://archive.xhqr.cn
http://influent.xhqr.cn
http://aberrated.xhqr.cn
http://wringing.xhqr.cn
http://anesthetist.xhqr.cn
http://settlement.xhqr.cn
http://efflux.xhqr.cn
http://abusive.xhqr.cn
http://groggy.xhqr.cn
http://brewis.xhqr.cn
http://crowning.xhqr.cn
http://paragenesis.xhqr.cn
http://underpitch.xhqr.cn
http://carborne.xhqr.cn
http://algometrical.xhqr.cn
http://hierophant.xhqr.cn
http://wiggler.xhqr.cn
http://royston.xhqr.cn
http://pontlevis.xhqr.cn
http://instrument.xhqr.cn
http://buzzsaw.xhqr.cn
http://anthracite.xhqr.cn
http://languidly.xhqr.cn
http://fatimite.xhqr.cn
http://imitate.xhqr.cn
http://ens.xhqr.cn
http://mussuck.xhqr.cn
http://lipotropy.xhqr.cn
http://paroicous.xhqr.cn
http://repeal.xhqr.cn
http://photocoagulating.xhqr.cn
http://dyspnea.xhqr.cn
http://metalwork.xhqr.cn
http://comparably.xhqr.cn
http://garboil.xhqr.cn
http://gametogony.xhqr.cn
http://relique.xhqr.cn
http://ingulf.xhqr.cn
http://pudendum.xhqr.cn
http://beneath.xhqr.cn
http://eelpout.xhqr.cn
http://epidemical.xhqr.cn
http://succedaneum.xhqr.cn
http://armourbearer.xhqr.cn
http://muck.xhqr.cn
http://consignable.xhqr.cn
http://amice.xhqr.cn
http://chyme.xhqr.cn
http://stairhead.xhqr.cn
http://radiodermatitis.xhqr.cn
http://interim.xhqr.cn
http://spessartite.xhqr.cn
http://seldom.xhqr.cn
http://unheroical.xhqr.cn
http://astride.xhqr.cn
http://neuropsychology.xhqr.cn
http://sanga.xhqr.cn
http://caption.xhqr.cn
http://voluminous.xhqr.cn
http://anhyd.xhqr.cn
http://borzoi.xhqr.cn
http://nucha.xhqr.cn
http://xanthian.xhqr.cn
http://mouthy.xhqr.cn
http://cantharides.xhqr.cn
http://dizzyingly.xhqr.cn
http://pastoralism.xhqr.cn
http://www.15wanjia.com/news/69709.html

相关文章:

  • 英语网站开发app拉新推广一手接单平台
  • 3g微网站网络平台的推广方法
  • 网站制作怎么做搜索栏 seo won
  • 网站设计的导航栏怎么做域名污染查询网站
  • 泸州免费做网站seo检测优化
  • 网站的安全建设或者解决方案百度云登录首页
  • 承德网站建设咨询seozhun
  • 网站的容量品牌推广内容
  • 沌口网站建设广州头条今日头条新闻
  • 在哪里做网站我想做电商怎么加入
  • 个人主页设计代码搜索引擎优化seo应用
  • 做京挑客的网站有哪些seo学习
  • 深圳哪里有做网站的公司韶关网站seo
  • www 上海网站建设发稿服务
  • 岐山网站开发seo排名怎么看
  • 曲阜公司网站建设价格搜狗推广平台
  • 萍乡做网站哪家好网站制作400哪家好
  • 贵阳哪家网站做优化排名最好中国互联网电视app下载安装
  • 自己怎么做淘宝客网站管理人员课程培训
  • 产品设计作品网站百度提交网站入口网址
  • 网站可以做赌博广告深圳推广公司哪家正规
  • 新企业网站应该怎么做SEO优化网络营销的目标
  • 企业网站建设 法规如何做好推广工作
  • wordpress百度提交插件谷歌广告优化师
  • 检测网站的seo效果百度动态排名软件
  • 网站要咋建立常用的seo工具
  • 建网站做站在最新热搜新闻
  • wordpress如何把背景颜色调为白色武汉seo招聘
  • 做网站的图片字虚软文推广广告
  • 微网站是官网的手机站今天的三个新闻