admin管理员组

文章数量:1130349

kkFileView二开之word转pdf接口

  • kkFileView二开系列文章:
  • 1 kkFileView源码下载及编译
  • 2 word转pdf接口
    • 2.1 背景
    • 2.2 接口开发
    • 2.3 接口测试
      • 2.3.1 word文件准备
      • 2.3.2 文件链接转pdf
      • 2.3.3 上传文件转pdf
  • 3 部署

kkFileView二开系列文章:

  1. kkFileView二开之源码编译及部署
  2. kkFileView二开之内外网转换
  3. kkFileView二开之word转pdf接口
  4. kkFileView二开之Excel转pdf接口
  5. kkFileView二开之pdf转图片接口
  6. kkFileView二开之企业级安全问题处理
    对应二开代码仓库:https://gitee/wbj_1/kk-file-view

1 kkFileView源码下载及编译

前文 【kkFileView二开之源码编译及部署】 已完成了kkFileView源码二开的基础准备。

2 word转pdf接口

2.1 背景

在实际工作过程中,经常会有系统针对word模板填充,并转换为pdf的需求,如合同、订单等文件,在代码内集成word转pdf一方面代码会比较臃肿,另一方面兼容性相较于kkfile会差一点。
在使用kkFileView的过程中,在线浏览word文档界面上可以以pdf的方式进行预览,因而想到可以使用kkFileView对外提供接口,传入指定的word文件后,将该文件转换为pdf后返回,通过阅读kkFileView源码后,发现可以实现,故编写该文档。

2.2 接口开发

在cn.keking.web.controller包下,新增ConvertController.java 文件

package cn.keking.web.controller;

import cn.keking.config.ConfigConstants;
import cn.keking.model.FileAttribute;
import cn.keking.model.FileType;
import cn.keking.model.ReturnResponse;
import cn.keking.service.FileHandlerService;
import cn.keking.service.OfficeToPdfService;
import cn.keking.utils.DownloadUtils;
import cn.keking.utils.KkFileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StreamUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org

kkFileView二开之word转pdf接口

  • kkFileView二开系列文章:
  • 1 kkFileView源码下载及编译
  • 2 word转pdf接口
    • 2.1 背景
    • 2.2 接口开发
    • 2.3 接口测试
      • 2.3.1 word文件准备
      • 2.3.2 文件链接转pdf
      • 2.3.3 上传文件转pdf
  • 3 部署

kkFileView二开系列文章:

  1. kkFileView二开之源码编译及部署
  2. kkFileView二开之内外网转换
  3. kkFileView二开之word转pdf接口
  4. kkFileView二开之Excel转pdf接口
  5. kkFileView二开之pdf转图片接口
  6. kkFileView二开之企业级安全问题处理
    对应二开代码仓库:https://gitee/wbj_1/kk-file-view

1 kkFileView源码下载及编译

前文 【kkFileView二开之源码编译及部署】 已完成了kkFileView源码二开的基础准备。

2 word转pdf接口

2.1 背景

在实际工作过程中,经常会有系统针对word模板填充,并转换为pdf的需求,如合同、订单等文件,在代码内集成word转pdf一方面代码会比较臃肿,另一方面兼容性相较于kkfile会差一点。
在使用kkFileView的过程中,在线浏览word文档界面上可以以pdf的方式进行预览,因而想到可以使用kkFileView对外提供接口,传入指定的word文件后,将该文件转换为pdf后返回,通过阅读kkFileView源码后,发现可以实现,故编写该文档。

2.2 接口开发

在cn.keking.web.controller包下,新增ConvertController.java 文件

package cn.keking.web.controller;

import cn.keking.config.ConfigConstants;
import cn.keking.model.FileAttribute;
import cn.keking.model.FileType;
import cn.keking.model.ReturnResponse;
import cn.keking.service.FileHandlerService;
import cn.keking.service.OfficeToPdfService;
import cn.keking.utils.DownloadUtils;
import cn.keking.utils.KkFileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StreamUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org

本文标签: 接口kkFileViewWordpdf