Tuesday, December 3, 2013

Embedding Attachments in visualforce page

Sometimes we need to embedd some files in visualforce pages(like invoice bills,etc). I got into same requirement to display a memo in visualforce page.
For that what I did is :

1) I let the users to add the memo to salesforce

2) I inserted the memo into attachments object

3) Then I quried the memo for the particular record.

4) Displayed the file by embedding inside visualforce page..

How to embed the attachment in visualforce page????

I tried this way,
By using the <OBJECT> and <EMBED> tags

<object data ="/servlet/servlet.Filedownload?file={!theattachmentid}" type="application/pdf" width="100%" height="500px">
<embed src ="/servlet/servlet.Filedownload?file={!theattachmentid}" width="100%" height="500px"/>
</object>

No comments:

Post a Comment