download multiple files or download into zip file

hi team ,in my application , when user selects the multiple checkbox then the single pdf will start downloading containing the data for all the checkboxes.  now i want  seperate pdf will download for the differernt checkboxes . how i can did this with java actions ? plz explain in brief .  Thanks in advance !!
3 answers

you may need to store all these pdf file as filedocument in list, then use java action to download the list as zip files.

The lib you need to use are:




import java.util.List;

import; import;


// input list object

private List<IMendixObject> fileList;


// the code to implement

ByteArrayOutputStream baos = new ByteArrayOutputStream();

ZipOutputStream zipOut = new ZipOutputStream(baos);

for (IMendixObject fileObj : fileList) {

   // Retrieve the name of the file

   String fileName = fileObj.getValue(getContext(), "Name").toString();

   // Create a new ZIP entry

   ZipEntry zipEntry = new ZipEntry(fileName); zipOut.putNextEntry(zipEntry);

   // Retrieve the content of the file

   InputStream fileContent = Core.getFileDocumentContent(getContext(), fileObj);

   // Write the content to the ZIP output stream

   byte[] bytes = new byte[1024];

   int length;

   while ((length = >= 0) { zipOut.write(bytes, 0, length); }


   zipOut.closeEntry(); }




   // Convert ByteArrayOutputStream to InputStream

    return new ByteArrayInputStream(baos.toByteArray());



the common approach is to zip all files (there are several modules for zip handling available) and download the archive.

You can't download multiple files from a single microflow. It might work to loop over the downloads in a nanoflow.

regards, Fabian


Or use a JavaScript action like I shared in below forum post to trigger the multi file download: