I get a PDF image as Base64Encoded bytes in an XML file, something like this(much longer, stripped):
JVBERi0xLjMKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMyAwIFIKL091dGxpbmVzIDIgMCBSCi9EZXN0cyA1IDAgUgovUGFnZU1vZGUgL1VzZU5vbm
Want to write java code to convert it into image file . I tried using javax.xml.bind.DatatypeConverter.printBase64Binary(byte[])
but not sure how to create byte[]
of above bytes.
You can use the sun.misc.BASE64Decoder
public byte[] fromBase64(String b64) {
BASE64Decoder decoder = new BASE64Decoder();
return decoder.decodeBuffer(b64)
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.