Print files from list view of Module and Subpanel

How to add print file button in Action menu of  record.?

When the user selects records in the list view (module) or is viewing the records in the subpanel, clicking on the Print Files button will cause the files in those records to mass print.  (Makes it more of a one step process to print instead of having to open each file, open the download, print the download one at a time.)

Parents Reply
  • <?php
    if (!defined('sugarEntry') || !sugarEntry) {
        die('Not A Valid Entry Point');
    class printEmailFileApi extends ModuleApi
        public function registerApiRest()
            return array(
                'printEmailFiles'    => array(
                    'reqType'   => 'POST',
                    'path'      => array('printEmailFile'),
                    'pathVars'  => array(''),
                    'method'    => 'printEmailFileData',
                    'shortHelp' => '',
                    'longHelp'  => '',
        public function printEmailFileData(RestService $api, array $args): array
            global $current_user; 
            global $timedate;
            $data         = array();
            $records      = array();
            $file_id	   =  $args["edocIds"];
            //get the file location
    		//$file->temp_file_location = UploadFile::get_upload_path($file_id);
    		//$file_contents = $file->get_file_contents();
            $data['fileData'] = 'fffff';//$file_contents;
            return $data;

    I am trying with 

    $file->temp_file_location = UploadFile::get_upload_path($file_id);
    $file_contents = $file->get_file_contents();
    but it's not working