code: public static void main (String args[]) {
          System.out.println("PDF document encryptor");
          if (args.length <= STRENGTH || args[PERMISSIONS].length() != 8) {
              usage();
              return;
          }
          try {
              int permissions = 0;
              String p = args[PERMISSIONS];
              for (int k = 0; k < p.length(); ++k) {
                  permissions |= (p.charAt(k) == '0' ? 0 : permit[k]);
              }
              System.out.println("Reading " + args[INPUT_FILE]);
              PdfReader reader = new PdfReader(args[INPUT_FILE]);
              System.out.println("Writing " + args[OUTPUT_FILE]);
              HashMap moreInfo = new HashMap();
              for (int k = MOREINFO; k < args.length - 1; k += 2)
                  moreInfo.put(args[k], args[k + 1]);
              PdfEncryptor.encrypt(reader, new FileOutputStream(args[OUTPUT_FILE]),
                  args[USER_PASSWORD].getBytes(), args[OWNER_PASSWORD].getBytes(), permissions, args[STRENGTH].equals("128"), moreInfo);
              System.out.println("Done.");
          }
          catch (Exception e) {
              e.printStackTrace();
          }
      }
docs: Encrypts a PDF document.
  
  @param args input_file output_file user_password owner_password permissions 128|40 [new info string pairs]