2

I am having 2-3 attachment of different type (pdf/image/text etc). I want to display content of all the attachment on single visualforce page. Is it possible? If yes how can i go for it?

2

How about looping over them and blatting out each one in an iframe?

AccountAttachments.page

<apex:page standardController="Account" sidebar="false">
    <apex:repeat value="{!Account.Attachments}" var="attachment">
        <h1>{!attachment.Name}</h1>
        <apex:iframe src="{!URLFOR($Action.Attachment.Download, attachment.Id)}" height="200" />
    </apex:repeat>
</apex:page>

screenshot

  • Its a good option but requirement is different. I want the attachments to display like a single pdf. suppose i have 1 image file, 1 pdf and 1 text file then i want to display them into a single pdf. – Pankaj Feb 19 '14 at 11:29
  • I just tested this in chrome and it correctly displays the files types that are listed in the question (pdf/image/text) but word and excel documents are not displayed. Instead they are downloaded automatically. – BarCotter Feb 19 '14 at 11:30
  • @Pankaj you might want to say that in the question then... – bigassforce Feb 19 '14 at 11:31
  • @BarCotter I see. Honestly, short of an applet or an extension I don't think it's gonna know how to render an .xls file etc. Chrome isn't Office, I feel that goes outside the bounds of behaviour a reasonable user could expect unfortunately. – bigassforce Feb 19 '14 at 11:36
  • @user320 I mean either in a single pdf or either continuously on vf page. in your current solution they seems like different files. – Pankaj Feb 19 '14 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.