I have a collection in MongoDB stores users' resumes, and they are stored as:
I've tried use python to convert it with this post, but the generated file cannot be viewed as pdf file.
The python code has:
import base64, os
from pymongo import *
client = MongoClient("mongodb://localhost:27017/")
db = client.local
collection = db.users
ppl = collection.find({
"_id": "38M8GoJS57Tp9MsGM"
})[0]
bindata = ppl["profile"]["resume"]
with open(os.path.expanduser('~/Desktop/test.pdf'), 'wb') as fout:
fout.write(base64.decodestring(bindata))
I wonder what I should do.