1.第一步,引入bc包的安装依赖。
在pom.xml中引入。
org.bouncycastle
bcprov-jdk15on
1.60
引入后reimport一下项目。
2.pdf文件转换成Base64.
/**
* @Description:
* @param:
* @return:
* @author: TateBrown
* @Date: 2018/7/25
*/
@ApiOperation("根据docid返回pdf文件Base64编码")
@PostMapping("/FindPDFBase")
public R FindPDFBase(@PathVariable("signdocid") Integer signdocid){
FileInputStream fin=null;
BufferedInputStream bin=null;
ByteArrayOutputStream baos=null;
BufferedOutputStream bout=null;
try{
SignDocEntity signDoc = signDocService.selectById(signdocid);
String filepath=signDoc.getUrl();
File file=new File(filepath);
if(!file.exists()){
return R.error("