If I understand your question correctly I would suggest you please check with below link from the stack exchange community with a similar discussion which might help you.
Thank you Nagendra and Shruti, I figered it out. Below is the code which i am using for getting the content from a notepad. Document d = [Select body, bodyLength, ContentType, Url from Document where name =: documentName]; Blob b = d.body; //String s = b.toString(); HttpRequest tmp = new HttpRequest(); tmp.setBodyAsBlob(b); String value = tmp.getBody();
But it is working for only Notepad, if i am trying to fetch the content of word or pdf files, its displaying in special characters.
If I understand your question correctly I would suggest you please check with below link from the stack exchange community with a similar discussion which might help you.
- https://salesforce.stackexchange.com/questions/169102/display-an-image-stored-in-contentdocument-in-lightning-experience
Please let us know if this helps.Kindly mark this as solved if the reply was helpful.
Thanks,
Nagendra
Document d = [Select body, bodyLength, ContentType, Url from Document where name =: documentName];
Blob b = d.body;
//String s = b.toString();
HttpRequest tmp = new HttpRequest();
tmp.setBodyAsBlob(b);
String value = tmp.getBody();
But it is working for only Notepad, if i am trying to fetch the content of word or pdf files, its displaying in special characters.