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
ethan huntethan hunt 

How to do multiple attachment preview in a single windowas pdf

I am trying this below code to view all the attachments in a single window as pdf, but i am unable to do it. Here i am using iframe.But it is not showing in a single
Is there any solution or workaround where i am view all the attachments in a single window as pdf.
public class AttachmentClass{
public string attachmentid {get; set;}
    public List<Attachment> atch {get; set;}
public AttachmentClass(){
    atch = new List<Attachment>();

    atch = [select Id from Attachment];
    For(Attachment a:atch){

<apex:repeat value="{!atch}" var="a">
    <iframe src="{!URLFOR($Action.Attachment.Download, a.Id)}"/>

What problem are you seeing? I've tried your code in my developer edition and it works fine. Any attachments that can't be previewed are downloaded, but the rest display in the browser. Might be worth checking your browser settings to ensure you aren't forcing download or something similar in all cases.