Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5990867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:18:20+00:00 2026-05-22T23:18:20+00:00

I have a web service that returns a base64 encoded string of a PDF

  • 0

I have a web service that returns a base64 encoded string of a PDF file.

I want to save this file to the SD Card. but when i try do this, adobe reader tells me that the file is corrupt. obviously i am not saving it properly.

byte[] pdfAsBytes = Base64.decode(resultsRequestSOAP.toString(), 0);

File filePath = new File(Environment.getExternalStorageDirectory()+"/braodcasts.pdf");
FileOutputStream os = new FileOutputStream(filePath, true);
os.write(pdfAsBytes);
os.close();

resultsRequestSOAP.toString() looks like this:

JVBERi0xLjUNCiW1tbW1DQoxIDAgb2JqDQo8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFIvTGFuZyhlbi1JRSkgPj4NCmVuZG9iag0KMiAwIG9iag0KPDwvVHlwZS9QYWdlcy9Db3VudCAxL0tpZHNbIDMgMCBSXSA+Pg0KZW5kb2JqDQozIDAgb2JqDQo8PC9UeXBlL1BhZ2UvUGFyZW50IDIgMCBSL1Jlc291cmNlczw8L0ZvbnQ8PC9GMSA1IDAgUj4+L0V4dEdTdGF0ZTw8L0dTNyA3IDAgUi9HUzggOCAwIFI+Pi9YT2JqZWN0PDwvSW1hZ2U5IDkgMCBSPj4vUHJvY1NldFsvUERGL1RleHQvSW1hZ2VCL0ltYWdlQy9JbWFnZUldID4+L01lZGlhQm94WyAwIDAgNTk1LjMyIDQxOS41Ml0gL0NvbnRlbnRzIDQgMCBSL0dyb3VwPDwvVHlwZS9Hcm91cC9TL1RyYW5zcGFyZW5jeS9DUy9EZXZpY2VSR0I+Pi9UYWJzL1M+Pg0KZW5kb2JqDQo0IDAgb2JqDQo8PC9GaWx0ZXIvRmxhdGVEZWNvZGUvTGVuZ3RoIDE0ND4+DQpzdHJlYW0NCnicLY29CgIxEIT7hX2HKVVw3ewluUsr/qCdGLAQC5HzqlPU9wdjcKaaYZhvmZkWGwfnRD3ynclBix18l6T0TRJ1yGOZbY8thg+TYqip+6ct03mC6QV5z7Quhy+muYpWWWjhLEqKCClIYzBTCRHvnuk0w4PJuyi+Uk07MbRWsWV6+2F343XoE1ZPHJi+nDkiaw0KZW5kc3RyZWFtDQplbmRvYmoNCjUgMCBvYmoNCjw8L1R5cGUvRm9udC9TdWJ0eXBlL1RydWVUeXBlL05hbWUvRjEvQmFzZUZvbnQvQUJDREVFK0NhbGlicmkvRW5jb2RpbmcvV2luQW5zaUVuY29kaW5nL0ZvbnREZXNjcmlwdG9yIDYgMCBSL0ZpcnN0Q2hhciAzMi9MYXN0Q2hhc

Thats just a snippet!

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:18:21+00:00Added an answer on May 22, 2026 at 11:18 pm

    Perhaps you can flush the FileOutputStream before you close it.

    os.write(pdfAsBytes);
    os.flush();
    os.close();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm working with web services that returns a base64 string representing a pdf file.
I have a web-service that returns a custom object, but now I want to
I have a third party web service that returns this xml <book> <release_date>0000-00-00</release_date> </book>
I have a web service that returns an xml string as results. The return
I have a web service that returns a decimal value into my json string
So I have a web service that returns this JSON: [{other_user:54,distance:1 ft,duration:1 min},{other_user:55,distance:2 ft,duration:5
Right, this is an odd one. We have a web service that returns data
I have a web service that returns a raw string of JSON data (sample
I have a WCF web service that returns a string to a Java based
I have a web service that contains this method: [WebMethod] public static List<string> GetFileListOnWebServer()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.