Arek - 2013-01-30

In Import module, there's an option "Merge Selected Files" which merges selected PDFs. I needed also to merge JPGs, so I did very simple patch to allow merging practicly all the graphic formats to PDF.

It would be great to include it in next version of DocMgr, I can polish it a bit if you wish (checking of allowed graphic formats).

File /docmgr/apilib/lib/docmgr/import.php, function merge()

    //the output file is the first file
    $arr = explode("/",$files[0]);
//    $arr[count($arr)-1] = "merged-".$arr[count($arr)-1];
    $arr[count($arr)-1] = "merged-".pathinfo($arr[count($arr)-1], PATHINFO_FILENAME).".pdf";
    $output = implode("/",$arr);
    //use ghostscript to merge the files
    //$cmd = APP_GS." -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=\"".$output."\" -dBATCH";
    //for ($i=0;$i<count($files);$i++)  $cmd .= " \"".$files[$i]."\" ";
    //use convert to merge the files
    $cmd = APP_CONVERT." "; 
    for ($i=0;$i<count($files);$i++)  $cmd .= " \"".$files[$i]."\" ";
    $cmd .= $output;

file modules/center/docmgr/docmgrimport/js/browse.js, function mergeFiles()

//  for (var i=0;i<files.length;i++)
//  {
//
            //make sure it's a pdf that we are trying to merge
//          if (getExtension(files[i])!="pdf") 
//          {
//              alert(_I18N_MERGE_TYPE_ERROR);
//              return false;
//          }
//  }