【已解决】Json收到的pdf字符串流,怎么转回pdf文件?急急急!

问题已经解决了,感谢showbo大佬!
请问各位大佬,调用别人的接口返回json字符串,有个是pdf的流,获取到这个字符串怎样通过springmvc返回pdf文件响应给前端下载?知道的大佬麻烦帮忙下,解决了留下微信50元红包作为感谢费。

其实就是2进制的base64编码,你要想将base64字符转为2进制,在输出或者保存就行了,asp.net已经解码出来,java的看这个

https://blog.csdn.net/qq_35624642/article/details/52193743

java将字符串转对象看这个:https://www.cnblogs.com/nihaorz/p/5885307.html

  /**
     * 二进制流转Base64字符串
     *
     * @param data 二进制流
     * @return data
     * @throws IOException 异常
     */
    public static String getImageString(byte[] data) throws IOException {
        BASE64Encoder encoder = new BASE64Encoder();
        return data != null ? encoder.encode(data) : "";
    }


    /**
     * Base64字符串转 二进制流
     *
     * @param base64String Base64
     * @return base64String
     * @throws IOException 异常
     */
    public static byte[] getStringImage(String base64String) throws IOException {
        BASE64Decoder decoder = new sun.misc.BASE64Decoder();
        return base64String != null ? decoder.decodeBuffer(base64String) : null;

    }
--------------------- 
作者:QC班长 
来源:CSDN 
原文:https://blog.csdn.net/qq_35624642/article/details/52193743 
版权声明:本文为博主原创文章,转载请附上博文链接!

附件的json数据是真实数据,能转为pdf文件