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

新手学做网站推荐软件宁波网站推广制作公司

新手学做网站推荐软件,宁波网站推广制作公司,上海建设工程信息网查询,wordpress伪静态配置不了【aspose-words-22.12-jdk17.jar】word文档转pdf 前置工作1、下载依赖2、安装依赖到本地仓库 项目1、配置pom.xml2、配置许可码文件#xff08;不配置会有水印#xff09;3、工具类4、效果 踩坑1、pdf乱码2、word中带有图片转换 前置工作 1、下载依赖 通过百度网盘分享的文… 【aspose-words-22.12-jdk17.jar】word文档转pdf 前置工作1、下载依赖2、安装依赖到本地仓库 项目1、配置pom.xml2、配置许可码文件不配置会有水印3、工具类4、效果 踩坑1、pdf乱码2、word中带有图片转换 前置工作 1、下载依赖 通过百度网盘分享的文件aspose-words-22.12-jdk17.jar 链接https://pan.baidu.com/s/137_fNgHCKSSEqcavWGehtA?pwd2xoe 提取码2xoe 2、安装依赖到本地仓库 xxxxxxxxxx jar下载之后的目录 mvn install:install-file -DgroupIdcom.aspose -DartifactIdaspose-words -Dversion15.8.0 -Dpackagingjar -DfileF:\java\xxxxxxxxxx\aspose-words-15.8.0-jdk16.jar项目 1、配置pom.xml !-- word转pdf --dependencygroupIdcom.aspose/groupIdartifactIdaspose-words/artifactIdversion15.8.0/version/dependency2、配置许可码文件不配置会有水印 在resource路径下配置license.xml文件 ?xml version1.0 encodingUTF-8 ? License DataProductsProductAspose.Total for Java/ProductProductAspose.Words for Java/Product/ProductsEditionTypeEnterprise/EditionTypeSubscriptionExpiry20991231/SubscriptionExpiryLicenseExpiry20991231/LicenseExpirySerialNumber8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7/SerialNumber /Data SignaturesNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppod0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU/Signature /License 3、工具类 package xxx.xxx.xx;import com.aspose.words.Document; import com.aspose.words.License; import com.aspose.words.SaveFormat; import lombok.extern.slf4j.Slf4j; import org.jeecg.common.exception.JeecgBootException; import org.jeecg.modules.online.config.exception.BusinessException;import java.io.ByteArrayOutputStream; import java.io.FileOutputStream; import java.io.InputStream;/*** 使用Aspose将Word转换为PDF的工具类* 注意需要在resource路径下配置license.xml文件*/ Slf4j public class Word2PdfUtil {public static void main(String[] args) {String inputPath F:\\opt\\upFiles\\2024-07-24\\2024072411362566_1721792185072.docx;String outputPath C:\\Users\\123\\Desktop\\1\\667\\bbb.pdf;try {doc2pdf(inputPath, outputPath);} catch (BusinessException e) {e.printStackTrace();}}/*** 将Word文档转换为PDF** param inPath 输入的Word文件路径* param outPath 输出的PDF文件路径*/public static void doc2pdf(String inPath, String outPath) throws BusinessException {// 如果未获取到许可证则抛出业务异常if (!getLicense()) {throw new BusinessException(未配置许可证!);}try (FileOutputStream os new FileOutputStream(outPath)) {long startTime System.currentTimeMillis();// 要转换的Word文档Document doc new Document(inPath);// 保存为PDF格式doc.save(os, SaveFormat.PDF);log.info(PDF转换完成耗时{}ms,输出路径:{}, System.currentTimeMillis() - startTime, outPath);} catch (Exception e) {e.printStackTrace();}}public static ByteArrayOutputStream doc2pdfByteArrayOutputStream(InputStream inputStream) {// 如果未获取到许可证则抛出业务异常if (!getLicense()) {throw new JeecgBootException(未配置许可证!);}try {long startTime System.currentTimeMillis();// 要转换的Word文档Document doc new Document(inputStream);ByteArrayOutputStream bao new ByteArrayOutputStream();doc.save(bao, SaveFormat.PDF);log.info(PDF转换完成耗时{}ms, System.currentTimeMillis() - startTime);return bao;} catch (Exception e) {e.printStackTrace();}return null;}/*** 获取Aspose的许可证* 如果未获取则转换的pdf带有水印** return 是否成功获取许可证*/public static boolean getLicense() {boolean result false;// license.xml文件应放在resource路径下try (InputStream is Word2PdfUtil.class.getClassLoader().getResourceAsStream(license.xml);) {License license new License();license.setLicense(is);result true;} catch (Exception e) {e.printStackTrace();}return result;}} 4、效果 踩坑 1、pdf乱码 将win机器的c:\windows\fonts目录下的全部文件拷贝到生产服务器字体安装目录下然后执行以下命令更新字体缓存 # 创建目录将win机器的c:\windows\fonts目录下的全部文件拷贝到此目录下 mkdir mkdir /usr/share/fonts/win cd /usr/share/fonts sudo fc-cache -fv # 执行命令让字体生效 source /etc/profile2、word中带有图片转换 word中如果有jpg格式的图片需要转换格式成 png
http://www.w-s-a.com/news/626720/

相关文章:

  • android电影网站开发网站建设与设计实习报告
  • 公司汇报网站建设方案烟台seo网站推广
  • 文章网站哪里建设好找素材的网站
  • 怎么做自己的彩票网站公司建设网站价格
  • 国外比较好的设计网站网站后台无法上传图片
  • 帮别人做网站的公司是外包吗用户登录
  • 关于我们网站模板小莉帮忙郑州阳光男科医院
  • 上海门户网站怎么登录永州网站制作
  • 微信网站模版下载做销售的去哪个网站应聘
  • 好看的个人博客主页长安网站优化公司
  • 企业网站关站大型综合新闻门户网站织梦模板
  • 网站优化排名易下拉效率查企业网站
  • 网站建设湛江关于汽车的网站
  • 南宁模板建站多少钱企业黄页名单
  • 企业网站的建设一般要素有网站定制公司地址
  • 婚纱摄影网站设计案例四川省城乡建设厅官方网站
  • 怎么做海淘网站wordpress首页表单
  • 大连网站优化技术长沙高端网站建设服务
  • 郎创网站建设做的网站 v2ex
  • 广东网站建设教程江西城乡住房建设网站
  • 做ppt卖给网站wordpress insert
  • 文化传媒公司网站模板wordpress转typecho
  • 网站建设设计视频郑州 服装网站建设
  • 网站建设什么公司好织梦cms默认密码
  • 大型网站 空间网上商城官网入口
  • 成都全美网站建设江苏专业网站建设
  • 足球网站模板有帮忙做阿里巴巴网站的吗
  • 建设厅报名网站京东网站的建设与发展前景
  • 金寨县住房和城乡建设部网站网页作业怎么做一个网站
  • 做ppt模板网站有哪些内容wap是什么意思卡老师