|
|
|
@ -33,7 +33,7 @@ public class PdfBaseUtil { |
|
|
|
* |
|
|
|
* @return 完整文件路径, |
|
|
|
*/ |
|
|
|
public static String getFilePath(String localFilePath) { |
|
|
|
public static String getFilePath(String localFilePath,String type) { |
|
|
|
// 1. 获取当前年月日并创建文件夹 |
|
|
|
Date now = new Date(); |
|
|
|
SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy"); |
|
|
|
@ -55,13 +55,13 @@ public class PdfBaseUtil { |
|
|
|
dir.mkdirs(); |
|
|
|
} |
|
|
|
// 4. 生成文件名 |
|
|
|
String fileName = "document_" + timestamp + ".pdf"; |
|
|
|
String fileName =type+ "_" + timestamp + ".pdf"; |
|
|
|
// 5. 完整文件路径 |
|
|
|
return Paths.get(folderPath, fileName).toString(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 添加带下划线的标题 |
|
|
|
* 添加标题 |
|
|
|
* |
|
|
|
* @param document PDF文档对象 |
|
|
|
* @param titleText 标题文本 |
|
|
|
@ -373,13 +373,13 @@ public class PdfBaseUtil { |
|
|
|
*/ |
|
|
|
private void addRepeatedWatermark(PdfContentByte content, float width, float height, String signText) { |
|
|
|
// 计算文字尺寸 |
|
|
|
float fontSize = Convert.toFloat("8"); |
|
|
|
float textWidth = baseFont.getWidthPoint(signText, fontSize); |
|
|
|
float fontSize = Convert.toFloat("10"); |
|
|
|
float textWidth = baseFont.getWidthPoint(signText, fontSize)+50; |
|
|
|
float textHeight = baseFont.getAscentPoint(signText, fontSize) - |
|
|
|
baseFont.getDescentPoint(signText, fontSize); |
|
|
|
|
|
|
|
// 计算间距 |
|
|
|
float stepX = textWidth + 150; |
|
|
|
float stepX = textWidth + 70; |
|
|
|
float stepY = textHeight + 100; |
|
|
|
|
|
|
|
// 添加重复水印 |
|
|
|
|