|
@ -438,7 +438,7 @@ public class ContractServiceImpl implements ContractService { |
|
|
int pageNum = document.getNumberOfPages(); |
|
|
int pageNum = document.getNumberOfPages(); |
|
|
if(pageNo<0 || pageNo>pageNum){ |
|
|
if(pageNo<0 || pageNo>pageNum){ |
|
|
String message = "签名页码超出范围(0~"+pageNum+"),请输入正确的签名页码,当前传入页码:"+pageNo; |
|
|
String message = "签名页码超出范围(0~"+pageNum+"),请输入正确的签名页码,当前传入页码:"+pageNo; |
|
|
return Result.OK("签名页码超出范围,输入正确的签名页码"); |
|
|
|
|
|
|
|
|
return Result.error("签名页码超出范围,输入正确的签名页码"); |
|
|
} |
|
|
} |
|
|
//3、由Document得到Page对象 |
|
|
//3、由Document得到Page对象 |
|
|
PDPage page = document.getPage(pageNo-1);//页码下标从0开始 |
|
|
PDPage page = document.getPage(pageNo-1);//页码下标从0开始 |
|
@ -455,8 +455,8 @@ public class ContractServiceImpl implements ContractService { |
|
|
//pageStream.drawImage(image, 450, 700,50,50); |
|
|
//pageStream.drawImage(image, 450, 700,50,50); |
|
|
|
|
|
|
|
|
//获取pdf宽度 |
|
|
//获取pdf宽度 |
|
|
float width = document.getPage(pageNo).getMediaBox().getWidth(); |
|
|
|
|
|
float height = document.getPage(pageNo).getMediaBox().getHeight(); |
|
|
|
|
|
|
|
|
float width = document.getPage(pageNo-1).getMediaBox().getWidth(); |
|
|
|
|
|
float height = document.getPage(pageNo-1).getMediaBox().getHeight(); |
|
|
positionX = (float) (width * positionX); |
|
|
positionX = (float) (width * positionX); |
|
|
positonY = (float) (height - (width * positonY)); |
|
|
positonY = (float) (height - (width * positonY)); |
|
|
imageWidth = (float) (width * imageWidth); |
|
|
imageWidth = (float) (width * imageWidth); |
|
@ -486,7 +486,7 @@ public class ContractServiceImpl implements ContractService { |
|
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
}catch (Exception e){ |
|
|
e.printStackTrace(); |
|
|
e.printStackTrace(); |
|
|
return Result.OK("pdf添加签名失败!"); |
|
|
|
|
|
|
|
|
return Result.error("pdf添加签名失败!"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return Result.OK("pdfPath", resultPdfPath); |
|
|
return Result.OK("pdfPath", resultPdfPath); |
|
|