function seal(file_name, file_path) {
	importPackage(com.kinggrid.pdf.executes);
	importPackage(Packages.com.kinggrid.pdf);
	importPackage(Packages.java.io);
	importPackage(Packages.java.util);

//	var pdf_key_path = '/app/data/rd_prod/web/WEB-INF/server-script/kinggrid/';
//	var pdf_key_name = pdf_key_path + 'iSignature_prod.key';
	var pdf_key_path = 'E:\\Workspace\\DR_Leasing\\web\\WEB-INF\\server-script\\kinggrid\\';
	var pdf_key_name = pdf_key_path + 'iSignature.key';
//	var cert_path = pdf_key_path + 'Sign.pfx';
	var cert_path = pdf_key_path + 'Sign.p12';
	var pdf_key_exists = 'Y';
	var sign_path = file_path + '_sign';
	var hummer = null;
	var fileOutputStream = null;
	var cert = null;

	try {

		function hummer_do_execute(text) {
			cert = new FileInputStream(cert_path);
			fileOutputStream = new FileOutputStream(sign_path);
			hummer = KGPdfHummer.createSignature(file_path, null, true,
					fileOutputStream,
//					new File("/home/hls/data/kinggrid_temp/"), true);
					new File("E:\\backup\\"), true);
			hummer.setCertificate(cert, "shghzl", "shghzl");
			var pdfSignature4KG = new PdfSignature4KG(pdf_key_name, 0, "123456");
			pdfSignature4KG.setText(text);
			hummer.setPdfSignature(pdfSignature4KG);
			try {
				// 捕捉没有盖章字样的pdf
				hummer.doSignature();
				return true;
			} catch (e) {
				println(e + ":" + text);
				return false;
			}
		}
		
		function hummer_do_sign(text) {
				fileOutputStream = new FileOutputStream(sign_path);
				hummer = KGPdfHummer.createInstance(file_path, null,true, fileOutputStream,true);
				var  pdfElectronicSeal4KG = new PdfElectronicSeal4KG("http://10.0.4.93:8089/iSignatureServer/OfficeServer.jsp",com.kinggrid.kgcore.enmu.KGServerTypeEnum.CA3,"081B341101300414","001","德融国际租赁有限公司公章");
				pdfElectronicSeal4KG.setText(text);
				hummer.addExecute(pdfElectronicSeal4KG);
				
			try {
				hummer.doExecute();
				return true;
			} catch (e) {
				println(e + ":" + text);
				return false;
			} 
		}

//		if (!hummer_do_execute("出租人(签章)")) {
//			if (!hummer_do_execute("授权单位(印章)")) {
//				var flag = hummer_do_execute("抵押权人盖章/电子签章");
//				if (!flag) {
//					pdf_key_exists == 'N';
//				}
//			}
//		}
		
		if (!hummer_do_sign("##")) {
			if (!hummer_do_sign("##")) {
				var flag = hummer_do_sign("##");
				if (!flag) {
					pdf_key_exists == 'N';
				}
			}
		}

		if (pdf_key_exists == 'N') {
			$ctx.parameter.sign_status = false;
		} else {
			$ctx.parameter.sign_status = true;
		}
	} catch (e) {
		raise_app_error(e);
	} finally {
		if (fileOutputStream != null) {
			fileOutputStream.close();
		}
		if (cert != null) {
			cert.close();
		}
		if (hummer != null)
			hummer.close();
		// new File(file_name).delete();
	}
	return sign_path;
}