Print multiple attachments

I know that I can access an attachment by using “/servlet/servlet.FileDownload?file={{Id}}”. Rob seems to say in this thread that you can put this inside of a img tag, to show multiple attachments on a single page. I have been experimenting with this, and it doesn’t seem to be working for me (not getting anything) . I have tried the img, iframe, embed, and object tag, and they all don’t display as nicely and cleanly as previewing the attachment. I would like to know if there is a good way to display an attachment as its full size, using a template.  

Also, assuming it is possible to display this, I would like to be able to print multiple attachments at one time. So assuming I have templates displaying Attachment 1,2,3,4 and 5, I would like to be able to print the entire page and get all 5 of the attachments printed in one print job. Is this possible??? Any ideas???

The only kind of attachments I was able to populate were images and PDF’s.  I used some JS code to render images in an IMG tag, and PDF’s in an iFrame.  

Quick thinking suggested that these were about the only attachment types that could be reliably rendered in browser, and it satisfied the customer demand. 

This was in a client org about 2 years ago - so its lost and fuzzy.  

I think we were that client. Our use case was a need to see multiple attachments for a specific record on the same page. Rob built out a page with record detail on the left and a preview of the attachments on the right.

There is a table on the right for the Attachments model and a field that is custom rendered with the following javascript:

var $ = skuid.$;var field = arguments[0];
var value = arguments[1];
var row = field.row;
var id = row.Id;

var ext = value.slice(-3);
//console.log(ext);
var text;

if (ext === “jpg”) {
text = “
+value
+“

”;
}
else
{ if (ext === “pdf”){
text = “
+value
+“

    else {text = "<A href = '/"
        +id
        +"'>Unknown File Type  "
        +value
        +" - Link to Detail</A>";
    }
}

//console.log(text);

field.element.append(text);

We only needed the view for images and pdfs for this particular use case. It would be interesting to know if it’s possible for word docs. We would also be interested in a print all function for all previewed attachments.

Hope this helps, Moshe.

HA! Thanks Chelsea.  I appreciate you sharing the work I did for you guys.  I hope your process is still running successfully.   Word docs are tough though. Mostly depends on the browser being used and how the OS is set up to handle those files. 

Still working great! That process is what made us choose Skuid:) We are very happy we did.

Thanks Chelsea and Rob, do either one of you remember what field the field renderer/javascript is running on? What field on the attachment object does the snippet run on?

It’s the Name field on the attachment object.

Any luck printing from this? I’m looking for a way to download multiple attachments. 

This will print the contents of the browser window, but I don’t think that is what you are after. 

Nope, I think I’ve got a solution through Conga though. Thanks!