1.第一步,引入bc包的安装依赖。
在pom.xml中引入。
<!-- https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on --> <dependency> <groupId>org.bouncycastle</groupId> <artifactId>bcprov-jdk15on</artifactId> <version>1.60</version> </dependency>
引入后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 = signD