JS Zip is a javascript library. You will not be able to invoke it from apex class. Only place where you can do it is from visualforce page. See if this helps,
var zip =newJSZip();
zip.file("Hello.txt","Hello World\n");
var img = zip.folder("images");
img.file("smile.gif", imgData,{base64:true});
var content = zip.generate();
location.href="data:application/zip;base64,"+content;
JS Zip is a javascript library. You will not be able to invoke it from apex class. Only place where you can do it is from visualforce page. See if this helps,
http://www.valnavjo.com/blog/compressing-files-in-salesforce/
Thanks for reply...
Here I need to use apex class. Is there any other alternate to make zip file using apex class?
Have you checked the link I gave? That have one sample code you may try. If this does not solve your purpose, please elaborate your requirement.
Yes Akram. We tried with same example before itself with visual force.
Our requirement is to make the attachments as zip file and need to attach the zip file to case using apex class.
Please provide any solution.
Hi Gen,
You mean - the use case is to Create a Zip file and add as an attachment to the case record?
Regards,
Ashish
Hi Gen,
This is the js code below might help.
http://stackoverflow.com/questions/16977247/create-zip-file-and-save-it-in-a-particular-location-using-javascript
http://viralpatel.net/blogs/create-zip-file-javascript/
Regards,
Ashish