Open shivamPatwal opened 3 years ago
hey @shivamPatwal hope this will work on java
import java.io.File; import java.io.FileOutputStream; import java.util.Base64;
class Base64DecodePdf { public static void main(String[] args) { File file = new File("./test.pdf"); try ( FileOutputStream fos = new FileOutputStream(file); ) { String b64 = "your binary stringdata"; byte[] decoder = Base64.getDecoder().decode(b64); fos.write(decoder); System.out.println("PDF File Saved"); } catch (Exception e) { e.printStackTrace(); } } }
i had successfully done Authorization using volley library in android and in response i am getting binary content.can someone help me how to convert this binary content to pdf using java...please provide code @shivamPatwal did you check this solution? its working or not please confirm.
hey @shivamPatwal hope this will work on java
import java.io.File; import java.io.FileOutputStream; import java.util.Base64;
class Base64DecodePdf { public static void main(String[] args) { File file = new File("./test.pdf"); try ( FileOutputStream fos = new FileOutputStream(file); ) { String b64 = "your binary stringdata"; byte[] decoder = Base64.getDecoder().decode(b64); fos.write(decoder); System.out.println("PDF File Saved"); } catch (Exception e) { e.printStackTrace(); } } }
getting java.lang.IllegalArgumentException: Illegal base64 character 25 error
i had successfully done Authorization using volley library in android and in response i am getting binary content.can someone help me how to convert this binary content to pdf using java...please provide code