0
votes

I'm trying to open a base64 encoded pdf sent back to me by a web service. This is the response header

Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, PUT, POST, PATCH, DELETE, OPTIONS, HEAD Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Type: application/json;charset=UTF-8
Server: Apache-Coyote/1.1
Transfer-Encoding: chunked
RESPONSE BODY
{
"success": true,
"message": "",
"value": "SlZCRVJpMHhMamNLSmJXMX.....
}

I tried an online decoder http://www.motobit.com/util/base64-decoder-encoder.asp to manually copy paste and convert the code.

when I save the resulting decoded text as a pdf and open it with adobe reader it gives a "not support or damaged file" error. I could be doing something wrong but I've looked around on the web and couldn't find anything. Here is the link to txt string of pdf

Any help is really appreciated. Thanks for your time.

1
and where is the response body? - Uku Loskit
Hey Uku. My bad. I've changed the post to include the response body and I've uploaded the 64base pdf as well. - Isabel Inc

1 Answers

1
votes

Your file is base64 encoded twice. To read it, you need to decode this twice as well. The web service should not be encoding it twice though. So, you should contact them to fix this.