1 Reply Latest reply: Sep 28, 2011 12:09 PM by Jeff Singer-Oracle RSS

    Batchprint with water mark

    891126
      i want to print many file with different watermark in batchprint.
      function onBodyLoad() {
      var PatheDetails='C:\\Oracle\\AutoVue\\bin\\Cache\\ADMIN28 09 11 04 34 30 472\\6038\\EDNSCRN.txt;C:\\Oracle\\AutoVue\\bin\\Cache\\ADMIN28 09 11 04 34 30 472\\6038\\EDNSCRN1.txt';
      submitFiles(PatheDetails);
      }

      function submitFiles(PatheDetails) {


      file = PatheDetails;

      if (file == "") {
      alert("Please enter a file name");
      } else {
      document.batchform.thelist[document.batchform.thelist.length] = new Option(file, file, false, true);
      document.batchform.reset();
      document.batchform.thelist.selectedIndex = document.batchform.thelist.length - 1;
      }






      //Advise user that batch printing is in process
      window.popupDlg = (document.all && window.print) ?

      /*ie5*/
      window.showModelessDialog('frmHeading.html', 'popupDlg', 'dialogHeight:70px;dialogWidth:200px;resizable:1;help:0;titlebar=0,scrollbars=0;status=0;menubar=0;toolbar=0') :

      /*not-ie5*/
      window.open('', 'popupDlg', 'height=50,width=200,resizable=1,titlebar=0,scrollbars=0,status=0,menubar=0,toolbar=0');

      window.popupDlg.document.open();
      window.popupDlg.document.write(window.msgBatchPrint);

      var allfiles = "";
      var counter = 0;
      var temp = "";
      var tempURL = "";

      if (document.batchform.thelist.length == 0) {
      alert("Please enter a file name to select files to print");
      return;
      }

      for (var i = 0; i < document.batchform.thelist.length; i++) {
      allfiles = allfiles + document.batchform.thelist.value + ";";
      }
      alert('allfiles '+allfiles );
      // Get list of files to print and put all paths to an array
      splitfiles = allfiles.split(";");
      counter = splitfiles.length - 1;

      var myApp = window.document.applets["JVue"];
      alert(myApp);
      // Create a PrintProperties class
      var pPropsClass = myApp.getClass("com.cimmetry.common.PrintProperties");

      // Instantiate the object
      var pProps = pPropsClass.newInstance();

      // Load default properties from the users preferences
      //--pProps.setProfile(myApp.getActiveVueBean().getProfile());

      //Load markups
      //myApp.openMarkup('*');

      //Set and Load headers here
      //pProps.getHeaders().setTopCenterText("My header is here");
      //pProps.getHeaders().setBottomLeftText("%f");
      //pProps.getHeaders().setBottomRightText("%p of %n");

      //Set and Load watermarks
      //pProps.getWatermark().setText("The watermark");

      // Print the extents of the drawing (PrintOptions.AREA_EXTENTS==0)
      pProps.getOptions().setArea(0);

      // Print all pages (PrintOptions.PAGES_ALL==0)
      pProps.getOptions().setPages(0);

      // Create a java.util.Vector class
      var vectorClass = myApp.getClass("java.util.Vector");

      // Instantiate the file list object
      var fileList = vectorClass.newInstance();

      //Go through each file, check if a URL or local file, upload and print file.
      for (var i=0; i < counter; i++) {
      if ((splitfiles[i].slice(0,7) == "http://") || (splitfiles[i].slice(0,8) == "https://")) {
      temp = splitfiles[i];
      } else {
      temp = "upload://" + splitfiles[i];
      alert('temp'+temp);
      }
      fileList.addElement(temp);
      }
      myApp.batchPrint(fileList,
                               pProps,
                               true/*openAllMarkups*/,
                               true/*useDefaultPrinter*/);

      //Reset all values when printing is finished
      allfiles="";
      splitfiles="";
      document.batchform.reset();
      for (var i = document.batchform.thelist.length - 1; i >= 0; i--) {
      document.batchform.thelist.options[i] = null;
      }
        • 1. Re: Batchprint with water mark
          Jeff Singer-Oracle
          Please provide more information on who you are (please create your username), what you're trying to do, where the files are stored and what problems you're encountering.

          I also see that you're referencing files in C:\Oracle\AutoVue\bin\Cache. That's not a good idea- you should be opening files from their original location.