doktor500
1/11/2017 - 10:54 AM

base64-to-pdf

import java.io.*;

import sun.misc.BASE64Decoder;

public class App {
    public static void main(String[] args) {     
        String encodedBytes = "stringBase64"; 
        try {
            BASE64Decoder decoder = new BASE64Decoder();
            byte[] decodedBytes;
            FileOutputStream outputStream;
            decodedBytes = new BASE64Decoder().decodeBuffer(encodedBytes);
            File file = new File("path/file.pdf");
            outputStream = new FileOutputStream(file);
            outputStream.write(decodedBytes);
            outputStream.flush();
            outputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}