bug:修复pdf打印空白问题

master
jian.wang 2 years ago
parent b92925cce5
commit 2c1fd373fe

@ -1337,6 +1337,7 @@ public class TemplateSearchController {
List<String> scanPathList = vo.getScanPathList(); List<String> scanPathList = vo.getScanPathList();
//每个文件名 //每个文件名
String fileName = vo.getInpatientNo().trim() + "-" + vo.getName().trim() + "-" + disDate.trim() + "_" + fmt.format(new Date()); String fileName = vo.getInpatientNo().trim() + "-" + vo.getName().trim() + "-" + disDate.trim() + "_" + fmt.format(new Date());
fileName = java.net.URLEncoder.encode(fileName, "UTF-8");
zos.putNextEntry(new ZipEntry(fileName + ".pdf")); zos.putNextEntry(new ZipEntry(fileName + ".pdf"));
//合成pdf //合成pdf
out = new ByteArrayOutputStream(); out = new ByteArrayOutputStream();
@ -1345,7 +1346,7 @@ public class TemplateSearchController {
bis = new BufferedInputStream(new ByteArrayInputStream(file)); bis = new BufferedInputStream(new ByteArrayInputStream(file));
//输出 //输出
int len = 0; int len = 0;
byte[] buf = new byte[100 * 1024]; byte[] buf = new byte[1024 * 1024];
while ((len = bis.read(buf, 0, buf.length)) != -1) { while ((len = bis.read(buf, 0, buf.length)) != -1) {
bos.write(buf, 0, len); bos.write(buf, 0, len);
} }

@ -617,6 +617,12 @@ public class CommomService {
Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
List<String> outs = new LinkedList<>(); List<String> outs = new LinkedList<>();
if (StringUtils.isNotBlank(names)) { if (StringUtils.isNotBlank(names)) {
if (new File(WATERPICPATH).isDirectory()) {
FileUtils.deleteDirectory(new File(WATERPICPATH));
}
if (!new File(WATERTIFTOJPGPATH).isDirectory()) {
FileUtils.deleteDirectory(new File(WATERTIFTOJPGPATH));
}
String[] rootPathList = rootPaths.split(","); String[] rootPathList = rootPaths.split(",");
String[] nameList = names.split(","); String[] nameList = names.split(",");
String[] sourceList = sources.split(","); String[] sourceList = sources.split(",");
@ -665,9 +671,6 @@ public class CommomService {
//目录不存在则创建 //目录不存在则创建
if (!new File(waterPicRoot).isDirectory()) { if (!new File(waterPicRoot).isDirectory()) {
new File(waterPicRoot).mkdirs(); new File(waterPicRoot).mkdirs();
}else{
FileUtils.deleteDirectory(new File(WATERPICPATH));
new File(waterPicRoot).mkdirs();
} }
//组织加水印后图片存放地址 //组织加水印后图片存放地址
String waterPicPath = waterPicRoot + nameList[i]; String waterPicPath = waterPicRoot + nameList[i];
@ -694,9 +697,6 @@ public class CommomService {
//保存目录不存在新增 //保存目录不存在新增
if (!new File(WATERTIFTOJPGPATH).isDirectory()) { if (!new File(WATERTIFTOJPGPATH).isDirectory()) {
new File(WATERTIFTOJPGPATH).mkdirs(); new File(WATERTIFTOJPGPATH).mkdirs();
}else{
FileUtils.deleteDirectory(new File(WATERPICPATH));
new File(WATERTIFTOJPGPATH).mkdirs();
} }
Date date = new Date(); Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS"); SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
@ -712,6 +712,7 @@ public class CommomService {
outSrc = EMRRECORDJSP + File.separator + root + "/jiashi/tifToJpgLoad/" + format1 + ".jpg"; outSrc = EMRRECORDJSP + File.separator + root + "/jiashi/tifToJpgLoad/" + format1 + ".jpg";
} else { } else {
srcPath = srcPath.replaceAll("\\\\","/"); srcPath = srcPath.replaceAll("\\\\","/");
if(srcPath.startsWith("/")){
//截取字符串为磁盘路径 //截取字符串为磁盘路径
int thirdBackslashIndex = srcPath.indexOf('/', srcPath.indexOf('/', srcPath.indexOf('/') + 1) + 1); int thirdBackslashIndex = srcPath.indexOf('/', srcPath.indexOf('/', srcPath.indexOf('/') + 1) + 1);
if (thirdBackslashIndex != -1) { if (thirdBackslashIndex != -1) {
@ -723,6 +724,13 @@ public class CommomService {
//获取盘符后面的地址 //获取盘符后面的地址
picPath = srcPath.substring(srcPath.indexOf('/')); picPath = srcPath.substring(srcPath.indexOf('/'));
outSrc = EMRRECORDJSP + File.separator + root + File.separator + picPath; outSrc = EMRRECORDJSP + File.separator + root + File.separator + picPath;
}else{
root = selectRootByNotWater(srcPath);
//获取盘符后面的地址
String str1 = srcPath.substring(0, srcPath.indexOf("/"));
picPath = srcPath.substring(str1.length() + 1, srcPath.length());
outSrc = EMRRECORDJSP + File.separator + root + picPath;
}
} }
} }
outs.add(outSrc); outs.add(outSrc);

@ -542,6 +542,8 @@ public class img2PdfUtil {
ExceptionPrintUtil.printException(e); ExceptionPrintUtil.printException(e);
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
System.out.println("-------------------------第一个流---------------------"+ stamper);
System.out.println("-------------------------第二个流---------------------"+ reader);
if (null != stamper) { if (null != stamper) {
try { try {
stamper.close(); stamper.close();

Loading…
Cancel
Save