添加电子签章

添加电子签章

再OFD文档上加个一个电子签章

调用示例

public void testSignatureByServer() {
      KGOfdHummer hummer = null;
            try {
                   //创建文档编辑实例
                  hummer = KGOfdHummer.createInstance("D:/ofd/test.ofd", null, "D:/ofd/1.ofd");
                  //设置开启多人会签模式(只对前台插Key模式签章有效)
                  hummer.setMultiUserSign(true);
                   //获取证书数据
                  File cer = new File("D:/ofd/servercert.cer");
                   //获取签章服务器地址
                  String url = "http://171.34.78.70:8899/iSignatureServer/OfficeServer.jsp";
                   //设置通过“签章服务器”或者“前台Key”对文档进行签章
                  OfdElectronicSeal4KG ofdElectronicSeal4KG = new OfdElectronicSeal4KG(url,"0672031308030317",null,0);
                   //从签章服务器获取印章通过加密机对文档进行签章
                  ofdElectronicSeal4KG.setInfomation(new SignatureInterByServer(ofdElectronicSeal4KG,cer,url));
                   //语义树定位,所有匹配的语义树都会加盖印章
                  //ofdElectronicSeal4KG.setTree("zzbh");
                   //坐标定位
                  ofdElectronicSeal4KG.setXY(100,100);
                   //设置需要操作的页码
                  //ofdElectronicSeal4KG.setPagen("1");
                   //文本定位,所有匹配的文本都会加盖印章
                  //ofdElectronicSeal4KG.setTree("抄送机关");
                  //ofdElectronicSeal4KG.setText("hogn");
                   //记录日志,必须是印章来着签章服务器,才能成功保存日志
                  //ofdElectronicSeal4KG.saveLog("documentID", "documentName", "logMemo","extparam1", "extparam2");
                  //OfdElectronicSeal4KG ofdElectronicSeal4KG1 = new OfdElectronicSeal4KG(url,"0672031308030317",null,1);
                  //ofdElectronicSeal4KG1.setXY(50,20);
                  //ofdElectronicSeal4KG1.setPagen(1);
                   //添加任务接口
                  //hummer.addExecute(ofdElectronicSeal4KG1);
                   //执行任务
                  hummer.addExecute(ofdElectronicSeal4KG);
                  hummer.doExecute();
            } catch (Exception e) {
                  e.printStackTrace();
            }
}