function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
KMK91KMK91 

displaying document content in lightning componentt

Hi,

I want to display document content in lightning component, how should i do it ? Please suggest some work around. Thank you.
NagendraNagendra (Salesforce Developers) 
Hi KMK91,

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. Please let us know if this helps.

Kindly mark this as solved if the reply was helpful.

Thanks,
Nagendra
KMK91KMK91
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.