查看pdf修改

master
ALW 3 years ago
parent 3d0ea8a568
commit 2bd840766e

@ -20,6 +20,7 @@ import com.emr.service.recordType.EmrTypeRelatedService;
import com.emr.service.recordType.EmrTypeService; import com.emr.service.recordType.EmrTypeService;
import com.emr.service.tScanAssort.T_Scan_AssortService; import com.emr.service.tScanAssort.T_Scan_AssortService;
import com.emr.util.ExceptionPrintUtil; import com.emr.util.ExceptionPrintUtil;
import com.emr.util.Jpg2PdfUtil;
import com.emr.util.img2PdfUtil; import com.emr.util.img2PdfUtil;
import com.emr.vo.EmrPrintOrDownLoadInfo.EmrPrintOrDownLoadInfoVo; import com.emr.vo.EmrPrintOrDownLoadInfo.EmrPrintOrDownLoadInfoVo;
import com.emr.vo.FontVo.ScanAssortVo; import com.emr.vo.FontVo.ScanAssortVo;
@ -38,6 +39,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -63,6 +65,8 @@ public class CommomSearchController {
@Autowired @Autowired
private CommomMapper commomMapper; private CommomMapper commomMapper;
@Autowired @Autowired
private Archive_DetailMapper archiveDetailMapper;
@Autowired
private EmrTypeRelatedService typeRelatedService; private EmrTypeRelatedService typeRelatedService;
@Autowired @Autowired
private T_Scan_AssortService scanAssortService; private T_Scan_AssortService scanAssortService;
@ -241,7 +245,7 @@ public class CommomSearchController {
String attending = null; String attending = null;
String fileSource = null; String fileSource = null;
List<CommomVo> commomVos = commomMapper.selectAllAndPatientId(patientId); List<CommomVo> commomVos = commomMapper.selectAllAndPatientId(patientId);
for (CommomVo list:commomVos){ for (CommomVo list : commomVos) {
admissTimes = list.getAdmissTimes(); admissTimes = list.getAdmissTimes();
name = list.getName(); name = list.getName();
fileSource = list.getFileSource(); fileSource = list.getFileSource();
@ -250,10 +254,10 @@ public class CommomSearchController {
attending = list.getAttending(); attending = list.getAttending();
} }
String userName = user.getUserPosition(); String userName = user.getUserPosition();
SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss "); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ");
Date date = new Date(System.currentTimeMillis()); Date date = new Date(System.currentTimeMillis());
String format = formatter.format(date); String format = formatter.format(date);
browseRecords browseRecords=new browseRecords(); browseRecords browseRecords = new browseRecords();
browseRecords.setAdmissTimes(admissTimes); browseRecords.setAdmissTimes(admissTimes);
browseRecords.setPatientName(name); browseRecords.setPatientName(name);
browseRecords.setDisDate(disDate); browseRecords.setDisDate(disDate);
@ -264,30 +268,30 @@ public class CommomSearchController {
browseRecords.setBrowseName(userName); browseRecords.setBrowseName(userName);
// 获取访问真实IP // 获取访问真实IP
String ipAddress = request.getHeader("x-forwarded-for"); String ipAddress = request.getHeader("x-forwarded-for");
if(ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
ipAddress = request.getHeader("Proxy-Client-IP"); ipAddress = request.getHeader("Proxy-Client-IP");
} }
if(ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
ipAddress = request.getHeader("WL-Proxy-Client-IP"); ipAddress = request.getHeader("WL-Proxy-Client-IP");
} }
if(ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
ipAddress = request.getRemoteAddr(); ipAddress = request.getRemoteAddr();
if("127.0.0.1".equals(ipAddress) || "0:0:0:0:0:0:0:1".equals(ipAddress)){ if ("127.0.0.1".equals(ipAddress) || "0:0:0:0:0:0:0:1".equals(ipAddress)) {
//根据网卡取本机配置的IP //根据网卡取本机配置的IP
InetAddress inet=null; InetAddress inet = null;
try { try {
inet = InetAddress.getLocalHost(); inet = InetAddress.getLocalHost();
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
e.printStackTrace(); e.printStackTrace();
} }
assert inet != null; assert inet != null;
ipAddress= inet.getHostAddress(); ipAddress = inet.getHostAddress();
} }
} }
//对于通过多个代理的情况第一个IP为客户端真实IP,多个IP按照','分割 //对于通过多个代理的情况第一个IP为客户端真实IP,多个IP按照','分割
if(ipAddress!=null && ipAddress.length()>15){ //"***.***.***.***".length() = 15 if (ipAddress != null && ipAddress.length() > 15) { //"***.***.***.***".length() = 15
if(ipAddress.indexOf(",")>0){ if (ipAddress.indexOf(",") > 0) {
ipAddress = ipAddress.substring(0,ipAddress.indexOf(",")); ipAddress = ipAddress.substring(0, ipAddress.indexOf(","));
} }
} }
browseRecords.setIp(ipAddress); browseRecords.setIp(ipAddress);
@ -296,7 +300,7 @@ public class CommomSearchController {
} }
@RequestMapping("showRecordSouth") @RequestMapping("showRecordSouth")
public String showRecordSouth(String patientId, String userName, String deptName ,Model model, HttpServletRequest request) { public String showRecordSouth(String patientId, String userName, String deptName, Model model, HttpServletRequest request) {
model.addAttribute("patientId", patientId); model.addAttribute("patientId", patientId);
model.addAttribute("userName", userName); model.addAttribute("userName", userName);
model.addAttribute("deptName", deptName); model.addAttribute("deptName", deptName);
@ -434,6 +438,7 @@ public class CommomSearchController {
/** /**
* 访 * 访
*
* @param userName * @param userName
* @param flag * @param flag
* @param model * @param model
@ -557,6 +562,7 @@ public class CommomSearchController {
if (typeId != null) { if (typeId != null) {
typeRelateds = typeRelatedService.selectAssortIdsByTypeId(typeId); typeRelateds = typeRelatedService.selectAssortIdsByTypeId(typeId);
} }
if (commomVos.size() > 0) {
//第一级:全部影像资料 //第一级:全部影像资料
CommomTree tree1 = new CommomTree(); CommomTree tree1 = new CommomTree();
Integer id = 1; Integer id = 1;
@ -645,6 +651,102 @@ public class CommomSearchController {
treeList.add(tree2); treeList.add(tree2);
} }
} }
}
List<Archive_Detail> archiveDetails = new ArrayList<>();
if (commomVos.size() == 0) {
List<CommomTree> archiveDetail = archiveDetailMapper.selectPdfPathByPatient2(patientId);
//第一级:全部影像资料
CommomTree tree1 = new CommomTree();
Integer id = 1;
tree1.setId(id);
tree1.setNewName("全部影像资料");
if (null != archiveDetail && !archiveDetail.isEmpty()) {
//去重,取出不重复的分类集合
Map<String, CommomTree> assortMap = new LinkedHashMap<>();
for (CommomTree commomVo1 : archiveDetail) {
assortMap.put(commomVo1.getAssortId(), commomVo1);
}
//判断分类是否全选,全选,父类跟着全选
if (null != typeRelateds && !typeRelateds.isEmpty()) {
boolean checkedFlag = true;
for (Map.Entry<String, CommomTree> map : assortMap.entrySet()) {
//定义是否存在
boolean flag = false;
for (Emr_Type_Related typeRelated : typeRelateds) {
if (typeRelated.getAssortId().equals(map.getKey())) {
flag = true;
break;
}
}
if (!flag) {
checkedFlag = false;
break;
}
}
if (checkedFlag) {
tree1.setChecked("true");
}
} else {
tree1.setChecked("true");
}
treeList.add(tree1);
int oneId = 0;
for (Map.Entry<String, CommomTree> map : assortMap.entrySet()) {
id++;
oneId = id;
String assortId = map.getValue().getAssortId();
CommomTree tree2 = new CommomTree();
tree2.setId(id);
tree2.setParentId(1);
tree2.setAssortId(map.getValue().getAssortId());
//判断选中
boolean checkFlag = false;
if (null != typeRelateds && !typeRelateds.isEmpty()) {
for (Emr_Type_Related typeRelated : typeRelateds) {
if (StringUtils.isNotBlank(assortId) && assortId.equals(typeRelated.getAssortId())) {
tree2.setChecked("true");
checkFlag = true;
break;
}
}
} else {
checkFlag = true;
tree2.setChecked("true");
}
//定义该类影像图片数量
int scanPathCount = 0;
//第二层 图片
int scanPathCountNum = 0;
for (CommomTree commomVo : archiveDetail) {
if (StringUtils.isNotBlank(assortId) && StringUtils.isNotBlank(commomVo.getAssortId()) &&
assortId.equals(commomVo.getAssortId())) {
id++;
CommomTree tree3 = new CommomTree();
tree3.setId(id);
tree3.setParentId(oneId);
tree3.setAssortId(assortId);
if (checkFlag) {
tree3.setChecked("true");
}
scanPathCount++;
//图片名称
String name = commomVo.getScanPage();
tree3.setAssortName(name);
//设置树图片节点的名称
tree3.setNewName(commomVo.getTitle());
tree3.setSource(commomVo.getSource());
//存储水印图片
treeList.add(tree3);
scanPathCountNum = commomVo.getPageCount();
}
}
tree2.setNewName(map.getValue().getAssortName() + "(" + scanPathCountNum + ")");
treeList.add(tree2);
}
}
}
return JSON.toJSONString(treeList); return JSON.toJSONString(treeList);
} catch (Exception e) { } catch (Exception e) {
ExceptionPrintUtil.printException(e); ExceptionPrintUtil.printException(e);
@ -673,6 +775,28 @@ public class CommomSearchController {
return ResultUtil.ok(outs); return ResultUtil.ok(outs);
} }
@RequestMapping(value = "selectPrintPic2", method = RequestMethod.POST)
@ResponseBody
public ResultUtil selectPrintPic2(HttpServletResponse response, String patientId, String rootPaths, String names, String sources, HttpServletRequest request) throws Exception {
//生成加载进度mapKey
Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
String mapKey = user.getUserName() + "_" + patientId;
List<String> outs = commomService.selectPrintPic2(response, patientId, names, sources, mapKey);
return ResultUtil.ok(outs);
}
// @RequestMapping("showPdf")
// public void showPdf(String patientId, HttpServletRequest request, HttpServletResponse response) {
// EmrPdfWaterSet emrPdfWaterSet = new EmrPdfWaterSet();
// Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
// String mapKey = user.getUserName() + "_" + patientId;
// List<String> fileList = (List<String>) request.getSession().getAttribute(mapKey);
// String pdfWater = "儿童医院";
// Jpg2PdfUtil.mulFile2One(response, fileList, pdfWater);
// }
/** /**
* *
* *
@ -714,9 +838,9 @@ public class CommomSearchController {
*/ */
@RequestMapping(value = "showRecordContentBlood") @RequestMapping(value = "showRecordContentBlood")
@ResponseBody @ResponseBody
public ResultUtil showRecordContentBlood(String patientId, String scanPages, String sources, String flag, HttpServletResponse response,HttpServletRequest request) { public ResultUtil showRecordContentBlood(String patientId, String scanPages, String sources, String flag, HttpServletResponse response, HttpServletRequest request) {
try { try {
commomService.showRecordContentBlood(patientId, scanPages, sources, flag, response,request); commomService.showRecordContentBlood(patientId, scanPages, sources, flag, response, request);
return ResultUtil.ok(); return ResultUtil.ok();
} catch (Exception e) { } catch (Exception e) {
ExceptionPrintUtil.printException(e); ExceptionPrintUtil.printException(e);
@ -727,12 +851,14 @@ public class CommomSearchController {
@RequestMapping(value = "getRecordContentBlood") @RequestMapping(value = "getRecordContentBlood")
@ResponseBody @ResponseBody
public void getRecordContentBlood(String patientId,HttpServletRequest request,HttpServletResponse response) { public void getRecordContentBlood(String patientId, HttpServletRequest request, HttpServletResponse response) {
List<CommomTree> commomTrees = archiveDetailMapper.selectPdfPathByPatient2(patientId);
if (commomTrees.size() == 0) {
try { try {
Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
String mapKey = user.getUserName() + "_" + patientId; String mapKey = user.getUserName() + "_" + patientId;
List<String> scanPages = (List<String>)request.getSession().getAttribute(mapKey); List<String> scanPages = (List<String>) request.getSession().getAttribute(mapKey);
if(!CollectionUtils.isEmpty(scanPages)) { if (!CollectionUtils.isEmpty(scanPages)) {
String pdfName = "档案管理PDF"; String pdfName = "档案管理PDF";
//根据图片路径转换pdf //根据图片路径转换pdf
EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1); EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1);
@ -740,11 +866,11 @@ public class CommomSearchController {
EmrPdfWaterSet emrPdfWaterSet1 = commomService.getEmrPdfWaterSet(emrPdfWaterSet); EmrPdfWaterSet emrPdfWaterSet1 = commomService.getEmrPdfWaterSet(emrPdfWaterSet);
//获取角色是否加水印 //获取角色是否加水印
Integer userSex = user.getUserSex(); Integer userSex = user.getUserSex();
if(userSex == null || userSex == 0){ if (userSex == null || userSex == 0) {
emrPdfWaterSet.setEffective(Short.valueOf("0")); emrPdfWaterSet.setEffective(Short.valueOf("0"));
emrPdfWaterSet1.setEffective(Short.valueOf("0")); emrPdfWaterSet1.setEffective(Short.valueOf("0"));
} }
img2PdfUtil.imageToPdf(response, scanPages, pdfName, emrPdfWaterSet,emrPdfWaterSet1); img2PdfUtil.imageToPdf(response, scanPages, pdfName, emrPdfWaterSet, emrPdfWaterSet1);
//移除缓存 //移除缓存
request.removeAttribute(mapKey); request.removeAttribute(mapKey);
} }
@ -752,10 +878,18 @@ public class CommomSearchController {
ExceptionPrintUtil.printException(e); ExceptionPrintUtil.printException(e);
e.printStackTrace(); e.printStackTrace();
} }
} else {
String pdfWater = "";
Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
String mapKey = user.getUserName() + "_" + patientId;
List<String> filePaths = (List<String>) request.getSession().getAttribute(mapKey);
Jpg2PdfUtil.mulFile2One(response, filePaths, pdfWater);
}
} }
/** /**
* 访 * 访
*
* @param patientId * @param patientId
* @param userName * @param userName
* @param scanPages * @param scanPages
@ -767,8 +901,8 @@ public class CommomSearchController {
@ResponseBody @ResponseBody
public void showRecordContentSouth(String patientId, String userName, String deptName, String scanPages, String sources, String flag, HttpServletResponse response, HttpServletRequest request) { public void showRecordContentSouth(String patientId, String userName, String deptName, String scanPages, String sources, String flag, HttpServletResponse response, HttpServletRequest request) {
try { try {
userName = (String)request.getSession().getAttribute("userName"); userName = (String) request.getSession().getAttribute("userName");
deptName = (String)request.getSession().getAttribute("deptName"); deptName = (String) request.getSession().getAttribute("deptName");
commomService.showRecordContentSouth(patientId, userName, deptName, scanPages, sources, flag, response); commomService.showRecordContentSouth(patientId, userName, deptName, scanPages, sources, flag, response);
} catch (Exception e) { } catch (Exception e) {
ExceptionPrintUtil.printException(e); ExceptionPrintUtil.printException(e);

@ -3,6 +3,7 @@ package com.emr.controller.templateSearch;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.emr.annotation.OptionalLog; import com.emr.annotation.OptionalLog;
import com.emr.controller.FormTokenFlagUtil; import com.emr.controller.FormTokenFlagUtil;
import com.emr.dao.Archive_DetailMapper;
import com.emr.dao.CommomMapper; import com.emr.dao.CommomMapper;
import com.emr.dao.EmrComomSetMapper; import com.emr.dao.EmrComomSetMapper;
import com.emr.dao.Emr_DictionaryMapper; import com.emr.dao.Emr_DictionaryMapper;
@ -27,6 +28,7 @@ import com.emr.service.emrPrintOrDownLoadInfo.PrintOrDownLoadInfoService;
import com.emr.service.templateSearch.TemplateSearchService; import com.emr.service.templateSearch.TemplateSearchService;
import com.emr.util.*; import com.emr.util.*;
import com.emr.vo.Msg; import com.emr.vo.Msg;
import com.emr.vo.commomSearch.CommomTree;
import com.emr.vo.commomSearch.CommomVo; import com.emr.vo.commomSearch.CommomVo;
import com.emr.vo.commomSearch.ScanPathForPatientListVo; import com.emr.vo.commomSearch.ScanPathForPatientListVo;
import com.emr.vo.commomSearch.ScanPathVo; import com.emr.vo.commomSearch.ScanPathVo;
@ -98,6 +100,8 @@ public class TemplateSearchController {
private EmrComomSetMapper emrComomSetMapper; private EmrComomSetMapper emrComomSetMapper;
@Autowired @Autowired
private CommomService commomService; private CommomService commomService;
@Autowired
private Archive_DetailMapper archiveDetailMapper;
/** /**
* @MethodName templateList * @MethodName templateList
@ -1323,6 +1327,19 @@ public class TemplateSearchController {
emrPdfWaterSet.setIsImg(emrPdfWaterSet.getDownloadIsImg()); emrPdfWaterSet.setIsImg(emrPdfWaterSet.getDownloadIsImg());
EmrPdfWaterSet emrPdfWaterSet1 = commomService.getEmrPdfWaterSet(emrPdfWaterSet); EmrPdfWaterSet emrPdfWaterSet1 = commomService.getEmrPdfWaterSet(emrPdfWaterSet);
img2PdfUtil.imageToPdf(response, filePaths, pdfName, emrPdfWaterSet,emrPdfWaterSet1); img2PdfUtil.imageToPdf(response, filePaths, pdfName, emrPdfWaterSet,emrPdfWaterSet1);
}else {
String fileRealPath=null;
List<CommomTree> commomTrees = archiveDetailMapper.selectPdfPathByPatient3(patientIds, assortIds);
List<String> filePaths = new ArrayList();
for (int i = 0; i < commomTrees.size(); ++i) {
fileRealPath = commomTrees.get(i).getPDFPATH();
if (StringUtils.isNoneBlank(new CharSequence[]{fileRealPath})) {
filePaths.add(fileRealPath);
}
}
SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd");
String filename=fmt.format(new Date());
Jpg2PdfUtil.mulFile2One3(response,filePaths,filename);
} }
} catch (Exception e) { } catch (Exception e) {
ExceptionPrintUtil.printException(e); ExceptionPrintUtil.printException(e);

@ -1,6 +1,7 @@
package com.emr.dao; package com.emr.dao;
import com.emr.entity.Archive_Detail; import com.emr.entity.Archive_Detail;
import com.emr.vo.commomSearch.CommomTree;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -12,5 +13,10 @@ public interface Archive_DetailMapper {
List<Archive_Detail> selectPdfPathByPatient(@Param("patientId")String patientId,@Param("assortIds")String assortIds); List<Archive_Detail> selectPdfPathByPatient(@Param("patientId")String patientId,@Param("assortIds")String assortIds);
List<CommomTree> selectPdfPathByPatient2(@Param("patientId")String patientId);
List<CommomTree> selectPdfPathByPatient3(@Param("patientIds")String patientIds,@Param("assortIds")String assortIds);
List<Archive_Detail> selectPdfCountByMasterId(@Param("patientId")String patientId); List<Archive_Detail> selectPdfCountByMasterId(@Param("patientId")String patientId);
} }

@ -19,8 +19,19 @@ public class Archive_Detail {
private String flag; private String flag;
private String sys; private String sys;
public String getAssortName() {
return assortName;
}
public void setAssortName(String assortName) {
this.assortName = assortName;
}
private String assortName;
public String getId() { public String getId() {
return id; return id;
} }

@ -227,7 +227,8 @@ public class CommomService {
if ("1".equals(sourceArr[i])) { if ("1".equals(sourceArr[i])) {
srcStr = root1 + File.separator + scanPageArr[i]; srcStr = root1 + File.separator + scanPageArr[i];
} else { } else {
srcStr = root2 + File.separator + scanPageArr[i]; // srcStr = root2 + File.separator + scanPageArr[i];
srcStr = scanPageArr[i];
} }
} }
src.add(srcStr); src.add(srcStr);
@ -639,6 +640,62 @@ public class CommomService {
return outs; return outs;
} }
public List<String> selectPrintPic2(HttpServletResponse response, String patientId,String names, String sources, String mapKey) {
List<String> outs = new LinkedList<>();
if (StringUtils.isNotBlank(names)) {
String[] nameList = names.split(",");
// String[] sourceList = sources.split(",");
//获取水印设置
EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1);
//获取是否打印文本水印
Short printEffective = emrPdfWaterSet.getPrintEffective();
//获取是否打印图片水印
Short printIsImg = emrPdfWaterSet.getPrintIsImg();
for (int i = 0; i < nameList.length; i++) {
//定义图片根目录地址
String rootPath = "";
//组织原图片地址
//原图片地址
String srcPath = nameList[i];
//定义输出地址
String outSrc = "";
//获取项目上下文地址
//不需要水印
String root = "";
String picPath = "";
//判断是否是tif图片
boolean tifFileFlag = checkTifFile(srcPath);
if(tifFileFlag){
String picSrc = WATERPICPATH + patientId + File.separator ;
//目录不存在则创建
if (!new File(picSrc).isDirectory()) {
new File(picSrc).mkdirs();
}
//组织加水印后图片存放地址
picPath = picSrc + nameList[i];
//转换图片输出
//tifToJpg(srcPath,picPath);
outSrc = EMRRECORDJSP + File.separator + "reload" + File.separator + patientId + File.separator + nameList[i];
}else{
//将原图片地址转换成映射地址
//获取盘符并转换映射地址的头部地址
root = selectRootByNotWater(srcPath);
//获取盘符后面的地址
String str1 = srcPath.substring(0, srcPath.indexOf(File.separator));
picPath = srcPath.substring(str1.length() + 1, srcPath.length());
outSrc = EMRRECORDJSP + File.separator + root + picPath;
outs.add(outSrc);
}
Integer value = Math.round((i + 1) * 100 / nameList.length);
printLoadingMap.put(mapKey, value);
}
}
return outs;
}
/** /**
* tif * tif
* @param srcPath * @param srcPath

@ -5,6 +5,7 @@ import com.lowagie.text.Font;
import com.lowagie.text.Image; import com.lowagie.text.Image;
import com.lowagie.text.pdf.*; import com.lowagie.text.pdf.*;
import com.lowagie.text.pdf.codec.TiffImage; import com.lowagie.text.pdf.codec.TiffImage;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -14,6 +15,7 @@ import java.io.*;
import java.net.URL; import java.net.URL;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Iterator;
import java.util.List; import java.util.List;
/** /**
@ -129,6 +131,287 @@ public class Jpg2PdfUtil {
writer.close(); writer.close();
} }
} }
public static boolean check(String file) {
PdfReader pdfReader = null;
try {
File f = new File(file);
if(f.isFile()){
pdfReader = new PdfReader(file);
if (pdfReader.getNumberOfPages() != 0) {
return true;
}
}
} catch (Exception e) {
}finally {
if(null != pdfReader){
pdfReader.close();
}
}
return false;
}
public static void mulFile2One(HttpServletResponse response,List<String> filePaths,String waterMarkName) {
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//遍历删除,除去损坏,文件不存在,抛异常就是空白页
Iterator<String> iterator = filePaths.iterator();
while (iterator.hasNext()) {
String fileStr = iterator.next();
File file = new File(fileStr);
if(file.isFile()){
boolean flag = check(fileStr);
if(!flag){
iterator.remove();
System.out.println(fmt.format(new Date())+":"+file+"文件损坏");
}
}else{
iterator.remove();
System.out.println(fmt.format(new Date())+":"+file+"文件不存在");
}
}
if(!filePaths.isEmpty()){
// pdf合并工具类
Document document = null;
PdfCopy copy = null;
try {
document = new Document(new PdfReader(filePaths.get(0)).getPageSize(1));
copy = new PdfCopy(document,response.getOutputStream());
document.open();
for (String file : filePaths) {
PdfReader reader = new PdfReader(file);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
PdfReader pdfReader = null;
//判断是否加水印
if (StringUtils.isNotBlank(waterMarkName)) {
setWatermark(bos, reader, waterMarkName, null);
pdfReader = new PdfReader(bos.toByteArray());
}
int n = reader.getNumberOfPages();
for (int j = 1; j <= n; j++) {
document.newPage();
PdfImportedPage page = null;
if (StringUtils.isNotBlank(waterMarkName)) {
page = copy.getImportedPage(pdfReader, j);
} else {
page = copy.getImportedPage(reader, j);
}
copy.addPage(page);
}
if(null != pdfReader){
pdfReader.close();
}
reader.close();
try {
bos.flush();
bos.close();
}catch (Exception e){
//e.printStackTrace();
}
}
}catch (Exception e){
//e.printStackTrace();
}finally {
if(null != document){
document.close();
}
}
}
}
public static void setWatermark(ByteArrayOutputStream bos, PdfReader reader, String waterMarkName, String imgPath){
PdfStamper stamper = null;
try {
stamper = new PdfStamper(reader, bos);
int total = reader.getNumberOfPages() + 1;
PdfContentByte content;
BaseFont base = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.EMBEDDED);
PdfGState gs = new PdfGState();
for (int i = 1; i < total; i++) {
content = stamper.getOverContent(i);// 在内容上方加水印
//加文字水印
if(StringUtils.isNotBlank(waterMarkName)) {
gs.setFillOpacity(0.3f);
gs.setStrokeOpacity(0.3f);
content.setGState(gs);
content.beginText();
content.setColorFill(Color.LIGHT_GRAY);
content.setFontAndSize(base, 50);
content.setTextMatrix(70, 200);
String[] waterMarks = waterMarkName.split("&");
//v:距左 v1:距下 v2:
content.showTextAligned(Element.ALIGN_CENTER, waterMarks[0], 250, 600, 40);
/*content.showTextAligned(Element.ALIGN_CENTER, waterMarks[0], 250, 200, 40);
content.showTextAligned(Element.ALIGN_CENTER, waterMarks[0], 800, 600, 40);
content.showTextAligned(Element.ALIGN_CENTER, waterMarks[0], 800, 200, 40);
content.showTextAligned(Element.ALIGN_CENTER, waterMarks[0], 250, 1100, 40);
content.showTextAligned(Element.ALIGN_CENTER, waterMarks[0], 250, 1500, 40);
content.showTextAligned(Element.ALIGN_CENTER, waterMarks[0], 800, 1100, 40);
content.showTextAligned(Element.ALIGN_CENTER, waterMarks[0], 800, 1500, 40);*/
if(waterMarks.length > 1){
//v:距左 v1:距下 v2:
content.showTextAligned(Element.ALIGN_CENTER, waterMarks[1], 310, 400, 40);
/* content.showTextAligned(Element.ALIGN_CENTER, waterMarks[1], 310, 150, 40);*/
/*content.showTextAligned(Element.ALIGN_CENTER, waterMarks[1], 860, 550, 40);
content.showTextAligned(Element.ALIGN_CENTER, waterMarks[1], 860, 150, 40);*/
/* content.showTextAligned(Element.ALIGN_CENTER, waterMarks[1], 300, 900, 40);
content.showTextAligned(Element.ALIGN_CENTER, waterMarks[1], 300, 1300, 40);
content.showTextAligned(Element.ALIGN_CENTER, waterMarks[1], 800, 900, 40);
content.showTextAligned(Element.ALIGN_CENTER, waterMarks[1], 800, 1300, 40);*/
}
content.endText();
}
if(StringUtils.isNotBlank(imgPath)){
Image image = Image.getInstance(imgPath);
image.setAbsolutePosition(200, 206); // set the first background
image.scaleToFit(200, 200);
content.addImage(image);
}
content.setColorFill(Color.BLACK);
content.setFontAndSize(base, 8);
}
} catch (IOException | DocumentException e) {
e.printStackTrace();
} finally {
try {
assert stamper != null;
stamper.close();
} catch (DocumentException | IOException e) {
e.printStackTrace();
}
}
}
public static void mulFile2One3(HttpServletResponse response,List<String> filePaths,String filename) {
String waterMarkName="";
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//遍历删除,除去损坏,文件不存在,抛异常就是空白页
Iterator<String> iterator = filePaths.iterator();
while (iterator.hasNext()) {
String fileStr = iterator.next();
File file = new File(fileStr);
if(file.isFile()){
boolean flag = check(fileStr);
if(!flag){
iterator.remove();
System.out.println(fmt.format(new Date())+":"+file+"文件损坏");
}
}else{
iterator.remove();
System.out.println(fmt.format(new Date())+":"+file+"文件不存在");
}
}
if(!filePaths.isEmpty()){
// pdf合并工具类
Document document = null;
PdfCopy copy = null;
try {
response.reset();
response.setCharacterEncoding("utf-8");
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "attachment; filename=" + filename + ".pdf");
document = new Document(new PdfReader(filePaths.get(0)).getPageSize(1));
copy = new PdfCopy(document,response.getOutputStream());
document.open();
for (String file : filePaths) {
PdfReader reader = new PdfReader(file);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
PdfReader pdfReader = null;
//判断是否加水印
if (StringUtils.isNotBlank(waterMarkName)) {
setWatermark(bos, reader, waterMarkName, null);
pdfReader = new PdfReader(bos.toByteArray());
}
int n = reader.getNumberOfPages();
for (int j = 1; j <= n; j++) {
document.newPage();
PdfImportedPage page = null;
if (StringUtils.isNotBlank(waterMarkName)) {
page = copy.getImportedPage(pdfReader, j);
} else {
page = copy.getImportedPage(reader, j);
}
copy.addPage(page);
}
if(null != pdfReader){
pdfReader.close();
}
reader.close();
try {
bos.flush();
bos.close();
}catch (Exception e){
//e.printStackTrace();
}
}
}catch (Exception e){
//e.printStackTrace();
}finally {
if(null != document){
document.close();
}
}
}
}
public static void mulFile2One2(HttpServletResponse response,List<String> filePaths) {
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//遍历删除,除去损坏,文件不存在,抛异常就是空白页
Iterator<String> iterator = filePaths.iterator();
while (iterator.hasNext()) {
String fileStr = iterator.next();
File file = new File(fileStr);
if(file.isFile()){
boolean flag = check(fileStr);
if(!flag){
iterator.remove();
System.out.println(fmt.format(new Date())+":"+file+"文件损坏");
}
}else{
iterator.remove();
System.out.println(fmt.format(new Date())+":"+file+"文件不存在");
}
}
if(!filePaths.isEmpty()){
// pdf合并工具类
Document document = null;
PdfCopy copy = null;
try {
response.reset();
response.setCharacterEncoding("utf-8");
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "attachment; "+"pdf");
document = new Document(new PdfReader(filePaths.get(0)).getPageSize(1));
copy = new PdfCopy(document,response.getOutputStream());
document.open();
for (String file : filePaths) {
PdfReader reader = new PdfReader(file);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
PdfReader pdfReader = null;
int n = reader.getNumberOfPages();
if(null != pdfReader){
pdfReader.close();
}
reader.close();
try {
bos.flush();
bos.close();
}catch (Exception e){
//e.printStackTrace();
}
}
}catch (Exception e){
//e.printStackTrace();
}finally {
if(null != document){
document.close();
}
}
}
}
/** /**
* h>whw>hw=h * h>whw>hw=h

@ -3,8 +3,29 @@ package com.emr.vo.commomSearch;
public class CommomTree { public class CommomTree {
private Integer id; private Integer id;
private String title;
private Integer parentId; private Integer parentId;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
private Integer PageCount;
public Integer getPageCount() {
return PageCount;
}
public void setPageCount(Integer pageCount) {
PageCount = pageCount;
}
private String patientId; private String patientId;
private String assortId; private String assortId;
@ -21,6 +42,16 @@ public class CommomTree {
private String source; private String source;
private String PDFPATH;
public String getPDFPATH() {
return PDFPATH;
}
public void setPDFPATH(String PDFPATH) {
this.PDFPATH = PDFPATH;
}
public String getSource() { public String getSource() {
return source; return source;
} }

@ -12,6 +12,8 @@
<result column="Title" property="title" jdbcType="NVARCHAR" /> <result column="Title" property="title" jdbcType="NVARCHAR" />
<result column="flag" property="flag" jdbcType="NVARCHAR" /> <result column="flag" property="flag" jdbcType="NVARCHAR" />
<result column="Sys" property="sys" jdbcType="NVARCHAR" /> <result column="Sys" property="sys" jdbcType="NVARCHAR" />
<result column="assort_name" property="assortName" jdbcType="NVARCHAR" />
</resultMap> </resultMap>
<insert id="insert" parameterType="com.emr.entity.Archive_Detail" > <insert id="insert" parameterType="com.emr.entity.Archive_Detail" >
insert into archive_detail (id, PDF_PATH, MasterID, insert into archive_detail (id, PDF_PATH, MasterID,
@ -103,6 +105,7 @@
AssortID in (${assortIds}) AssortID in (${assortIds})
ORDER BY zd_assort.assort_sort,UpLoadDateTime ORDER BY zd_assort.assort_sort,UpLoadDateTime
</select> </select>
<!--查询pdf路径逗号拼接--> <!--查询pdf路径逗号拼接-->
<select id="selectPdfCountByMasterId" resultMap="BaseResultMap"> <select id="selectPdfCountByMasterId" resultMap="BaseResultMap">
select AssortID, select AssortID,
@ -112,4 +115,39 @@
from archive_detail c where c.MasterID = #{patientId} from archive_detail c where c.MasterID = #{patientId}
group by c.AssortID group by c.AssortID
</select> </select>
<select id="selectPdfPathByPatient2" resultType="com.emr.vo.commomSearch.CommomTree"
parameterType="java.lang.String">
SELECT
archive_detail.PDF_PATH,
archive_detail.MasterID as patient_id,
archive_detail.AssortID as assort_id,
zd_assort.assort_name,
archive_detail.PDF_PATH as scan_page,
archive_detail.Source as source,
archive_detail.PageCount,
archive_detail.Title as title
FROM
archive_detail
LEFT JOIN zd_assort
ON archive_detail.AssortID = zd_assort.assort_id
WHERE
MasterID = #{patientId} and flag != 1
ORDER BY zd_assort.assort_sort,UpLoadDateTime
</select>
<select id="selectPdfPathByPatient3" resultType="com.emr.vo.commomSearch.CommomTree">
SELECT
archive_detail.PDF_PATH,
archive_detail.MasterID as patient_id,
archive_detail.AssortID as assort_id,
zd_assort.assort_name,
archive_detail.PDF_PATH as scan_page,
archive_detail.Source as source
FROM
archive_detail
LEFT JOIN zd_assort
ON archive_detail.AssortID = zd_assort.assort_id
WHERE
MasterID = #{patientIds}
ORDER BY zd_assort.assort_sort,UpLoadDateTime
</select>
</mapper> </mapper>

@ -58,7 +58,7 @@
ON ON
dbo.zd_assort.assort_id = dbo.t_scan_assort.assort_id dbo.zd_assort.assort_id = dbo.t_scan_assort.assort_id
<where> <where>
dbo.commomtable.patient_id in (${patientIds}) dbo.commomtable.patient_id =#{patientIds}
AND t_scan_assort.is_del != 1 AND t_scan_assort.is_del != 1
<if test="assortIds != null"> <if test="assortIds != null">
AND dbo.t_scan_assort.scan_page in (${assortIds}) AND dbo.t_scan_assort.scan_page in (${assortIds})

@ -215,13 +215,13 @@
</div> </div>
<!--表格头--> <!--表格头-->
<input type="hidden" id="tableThNames" <input type="hidden" id="tableThNames"
value="病案号,ID号,住院次数,姓名,性别,年龄_岁,年龄_月,入院日期,出院日期,出院科室,联系地址,主诊ICD码,主诊名称,主诊转归,住院天数,主治医生,其他诊断,病理诊断,损伤中毒,是否有手术,病案备注"> value="病案号,ID号,住院次数,姓名,性别,年龄_岁,年龄_月,入院日期,出院日期,出院科室,联系地址,主诊ICD码,主诊名称,主诊转归,住院天数,主治医生,其他诊断,病理诊断,损伤中毒,是否有手术,病案备注,盘号">
<!--查询字段--> <!--查询字段-->
<input type="hidden" id="englishFields" <input type="hidden" id="englishFields"
value="commomtable.inpatient_no,commomtable.admiss_id,commomtable.admiss_times,commomtable.name,commomtable.sex,commomtable.age,commomtable.age_month,commomtable.admiss_date,commomtable.dis_date,commomtable.dis_dept,commomtable.home_addr,commomtable.main_diag_code,commomtable.main_diag_name,commomtable.main_dis_thing,commomtable.admiss_days,commomtable.attending,commomtable.other_diag_name,commomtable.pathology_name,commomtable.poisoning_name,commomtable.is_oper,memo,commomtable.file_source"> value="commomtable.inpatient_no,commomtable.admiss_id,commomtable.admiss_times,commomtable.name,commomtable.sex,commomtable.age,commomtable.age_month,commomtable.admiss_date,commomtable.dis_date,commomtable.dis_dept,commomtable.home_addr,commomtable.main_diag_code,commomtable.main_diag_name,commomtable.main_dis_thing,commomtable.admiss_days,commomtable.attending,commomtable.other_diag_name,commomtable.pathology_name,commomtable.poisoning_name,commomtable.is_oper,memo,commomtable.file_source,commomtable.ph">
<!--数据字段--> <!--数据字段-->
<input type="hidden" id="fields" <input type="hidden" id="fields"
value="inpatientNo,admissId,admissTimes,name,sex,age,ageMonth,admissDate,disDate,disDept,homeAddr,mainDiagCode,mainDiagName,mainDisThing,admissDays,attending,otherDiagName,pathologyName,poisoningName,isOper,memo,fileSource"> value="inpatientNo,admissId,admissTimes,name,sex,age,ageMonth,admissDate,disDate,disDept,homeAddr,mainDiagCode,mainDiagName,mainDisThing,admissDays,attending,otherDiagName,pathologyName,poisoningName,isOper,memo,ph">
<!--显示字段--> <!--显示字段-->
<input type="hidden" id="fieldCns"> <input type="hidden" id="fieldCns">
<!--查询总行数--> <!--查询总行数-->

File diff suppressed because one or more lines are too long

@ -137,15 +137,16 @@ function onloadPdf(scanPages, sources) {
success: function (data) { success: function (data) {
if (data.code == 0) { if (data.code == 0) {
var str = path + "/commom/getRecordContentBlood?patientId=" + patientId; var str = path + "/commom/getRecordContentBlood?patientId=" + patientId;
$("#iframe1").attr("src", path + "/static/pdfjs/web/viewer1.html?file=" + encodeURIComponent(str)); $("#iframe1").attr("src", path + "/static/pdfjs/web/viewer.html?file=" + encodeURIComponent(str))
var rootPaths = parent.$("#rootPaths").val(); var rootPaths = parent.$("#rootPaths").val();
//加载的图片
var print = $("#print").val(); var print = $("#print").val();
if (rootPaths!=",") {
if (scanPages != '' && print == 1) { if (scanPages != '' && print == 1) {
selectPrintPic(patientId, rootPaths, scanPages, sources); selectPrintPic(patientId, rootPaths, scanPages, sources);
} }
} }
} }
}
}) })
} }
/*function onloadPdf(scanPages, sources) { /*function onloadPdf(scanPages, sources) {
@ -181,6 +182,62 @@ function selectPrintPic(patientId, rootPaths, scanPages, sources) {
sources: sources sources: sources
}, },
datType: 'json', datType: 'json',
success: function (data) {
if (data.code == 0) {
var resultList = data.data;
if (null != resultList) {
var img = '';
for (var i = 0; i < resultList.length; i++) {
img += "<img src='" + resultList[i] + "' width='850' height='1190'>";
}
var interval = setInterval(function () {
if ($("#iframeLoad").val() == 1) {
// iframe.contentDocument.getElementById("printContainer1").innerHTML = img;
$("#printPicLoaded").val(1);
// iframe.contentDocument.getElementById("printLoading").style.display = 'none';
// iframe.contentDocument.getElementById("print").style.display = 'block';
clearInterval(interval);
}
}, 200);
}
} else {
toastr.error(data.msg);
}
}
})
//查询进度定时器
var interval1 = setInterval(function () {
$.ajax({
type: 'get',
url: path + "/commom/getPrintPicLoading",
data: {patientId: $("#patientId").val()},
dataType: 'json',
success: function (data) {
if (data.code == 0) {
var value = data.data;
$("#loading").val(value + "%");
if (value == 100) {
//杀死进度定时器
clearInterval(interval1);
}
} else {
toastr.error(data.msg);
}
}
})
}, 100);
}
function selectPrintPic2(patientId, scanPages, sources) {
$.ajax({
type: 'post',
url: path + "/commom/selectPrintPic2",
data: {
patientId: patientId,
names: scanPages,
sources: sources
},
datType: 'json',
success: function (data) { success: function (data) {
if (data.code == 0) { if (data.code == 0) {
var resultList = data.data; var resultList = data.data;
@ -257,7 +314,7 @@ function onloadJpgForPdf() {
message: "确认将左侧树选中的图片下载pdf?", message: "确认将左侧树选中的图片下载pdf?",
operate: function (reselt) { operate: function (reselt) {
if (reselt) { if (reselt) {
var patientId = "'" + $("#patientId").val() + "'"; var patientId = $("#patientId").val();
var assortIds = $("#assortIds").val(); var assortIds = $("#assortIds").val();
var flag = parent.$("#flag").val(); var flag = parent.$("#flag").val();
post(path + '/template/downloadPdfBlood', { post(path + '/template/downloadPdfBlood', {

@ -18,7 +18,7 @@ Adobe CMap resources are covered by their own copyright and license:
http://sourceforge.net/adobe/cmap/wiki/License/ http://sourceforge.net/adobe/cmap/wiki/License/
--> -->
<html dir="ltr" mozdisallowselectionprint moznomarginboxes> <html dir="ltr" mozdisallowselectionprint moznomarginboxes>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="google" content="notranslate"> <meta name="google" content="notranslate">
@ -31,15 +31,15 @@ http://sourceforge.net/adobe/cmap/wiki/License/
<!-- This snippet is used in production (included from viewer.html) --> <!-- This snippet is used in production (included from viewer.html) -->
<link rel="resource" type="application/l10n" href="locale/locale.properties"/> <link rel="resource" type="application/l10n" href="locale/locale.properties"/>
<link rel="shortcut icon" href="/emr_medical_record/favicon.ico"> <link rel="shortcut icon" href="../../js/favicon.ico">
<script type="text/javascript" src="../../js/jquery-3.3.1.js"></script> <script type="text/javascript" src="../../js/jquery-3.3.1.js"></script>
<script type="text/javascript" src="../../bootstrap-3.3.7/bower_components/bootstrap/dist/js/bootstrap.min.js"></script> <script type="text/javascript" src="../../bootstrap-3.3.7/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="l10n.js"></script> <script src="l10n.js"></script>
<script src="../build/pdf.js"></script> <script src="../build/pdf.js?time=2020-08-21"></script>
<script src="debugger.js"></script> <script src="debugger.js"></script>
<script src="viewer.js"></script> <script src="viewer.js?time=2020-08-27"></script>
<style> <style>
.loading { .loading {
@ -87,15 +87,15 @@ http://sourceforge.net/adobe/cmap/wiki/License/
opacity: 1; opacity: 1;
} }
</style> </style>
</head> </head>
<body tabindex="1" class="loadingInProgress" onkeydown="disabledPrint()"> <body tabindex="1" class="loadingInProgress" onkeydown="disabledPrint()">
<div id="myModal" class="modal fade" data-keyboard="false" <div id="myModal" class="modal fade" data-keyboard="false"
data-backdrop="static" data-role="dialog" data-backdrop="static" data-role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true"> aria-labelledby="myModalLabel" aria-hidden="true">
<div id="loading" class="loading">加载中。。。</div> <div id="loading" class="loading">加载中。。。</div>
</div> </div>
<div id="outerContainer"> <div id="outerContainer">
<div id="sidebarContainer"> <div id="sidebarContainer">
<div id="toolbarSidebar"> <div id="toolbarSidebar">
@ -224,15 +224,20 @@ http://sourceforge.net/adobe/cmap/wiki/License/
<span data-l10n-id="presentation_mode_label">Presentation Mode</span> <span data-l10n-id="presentation_mode_label">Presentation Mode</span>
</button> </button>
<button id="print" class="toolbarButton print hiddenMediumView" title="Print" tabindex="33" data-l10n-id="print">
<span data-l10n-id="print_label">Print</span>
</button>
<!--<button id="openFile" class="toolbarButton openFile hiddenLargeView" title="Open File" tabindex="32" data-l10n-id="open_file"> <!--<button id="openFile" class="toolbarButton openFile hiddenLargeView" title="Open File" tabindex="32" data-l10n-id="open_file">
<span data-l10n-id="open_file_label">Open</span> <span data-l10n-id="open_file_label">Open</span>
</button>--> </button>-->
<!--<button id="print" class="toolbarButton print hiddenMediumView" title="Print" tabindex="33" data-l10n-id="print">
<span data-l10n-id="print_label">Print</span>
</button>
<button id="download" class="toolbarButton download hiddenMediumView" title="Download" tabindex="34" data-l10n-id="download">
<!--<button id="download" class="toolbarButton download hiddenMediumView" title="Download" tabindex="34" data-l10n-id="download">
<span data-l10n-id="download_label">Download</span> <span data-l10n-id="download_label">Download</span>
</button>--> </button>-->
<!-- <a href="#" id="viewBookmark" class="toolbarButton bookmark hiddenSmallView" title="Current view (copy or open in new window)" tabindex="35" data-l10n-id="bookmark"> <!-- <a href="#" id="viewBookmark" class="toolbarButton bookmark hiddenSmallView" title="Current view (copy or open in new window)" tabindex="35" data-l10n-id="bookmark">
@ -258,14 +263,14 @@ http://sourceforge.net/adobe/cmap/wiki/License/
</div> </div>
<span id="scaleSelectContainer" class="dropdownToolbarButton"> <span id="scaleSelectContainer" class="dropdownToolbarButton">
<select id="scaleSelect" title="Zoom" tabindex="23" data-l10n-id="zoom"> <select id="scaleSelect" title="Zoom" tabindex="23" data-l10n-id="zoom">
<option id="pageAutoOption" title="" value="auto" selected="selected" data-l10n-id="page_scale_auto">Automatic Zoom</option> <option id="pageAutoOption" title="" value="auto" data-l10n-id="page_scale_auto">Automatic Zoom</option>
<option id="pageActualOption" title="" value="page-actual" data-l10n-id="page_scale_actual">Actual Size</option> <option id="pageActualOption" title="" value="page-actual" data-l10n-id="page_scale_actual">Actual Size</option>
<option id="pageFitOption" title="" value="page-fit" data-l10n-id="page_scale_fit">Fit Page</option> <option id="pageFitOption" title="" value="page-fit" data-l10n-id="page_scale_fit">Fit Page</option>
<option id="pageWidthOption" title="" value="page-width" data-l10n-id="page_scale_width">Full Width</option> <option id="pageWidthOption" title="" value="page-width" data-l10n-id="page_scale_width">Full Width</option>
<option id="customScaleOption" title="" value="custom"></option> <option id="customScaleOption" title="" value="custom"></option>
<option title="" value="0.5" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 50 }'>50%</option> <option title="" value="0.5" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 50 }'>50%</option>
<option title="" value="0.75" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 75 }'>75%</option> <option title="" value="0.75" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 75 }'>75%</option>
<option title="" value="1" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 100 }'>100%</option> <option title="" value="1" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 100 }' selected="selected">100%</option>
<option title="" value="1.25" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 125 }'>125%</option> <option title="" value="1.25" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 125 }'>125%</option>
<option title="" value="1.5" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 150 }'>150%</option> <option title="" value="1.5" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 150 }'>150%</option>
<option title="" value="2" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 200 }'>200%</option> <option title="" value="2" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 200 }'>200%</option>
@ -382,19 +387,19 @@ http://sourceforge.net/adobe/cmap/wiki/License/
</div> </div>
</div> <!-- overlayContainer --> </div> <!-- overlayContainer -->
</div> <!-- outerContainer --> </div> <!-- outerContainer -->
<div id="printContainer"></div> <div id="printContainer"></div>
<div id="mozPrintCallback-shim" hidden> <div id="mozPrintCallback-shim" hidden>
<style> <style>
@media print { @media print {
#printContainer div { #printContainer div {
page-break-after: always; page-break-after: always;
page-break-inside: avoid; page-break-inside: avoid;
} }
} }
</style> </style>
<style scoped> <style scoped>
#mozPrintCallback-shim { #mozPrintCallback-shim {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
@ -405,17 +410,17 @@ http://sourceforge.net/adobe/cmap/wiki/License/
display: block; display: block;
text-align: center; text-align: center;
background-color: rgba(0, 0, 0, 0.5); background-color: rgba(0, 0, 0, 0.5);
} }
#mozPrintCallback-shim[hidden] { #mozPrintCallback-shim[hidden] {
display: none; display: none;
} }
@media print { @media print {
#mozPrintCallback-shim { #mozPrintCallback-shim {
display: none; display: none;
} }
} }
#mozPrintCallback-shim .mozPrintCallback-dialog-box { #mozPrintCallback-shim .mozPrintCallback-dialog-box {
display: inline-block; display: inline-block;
margin: -50px auto 0; margin: -50px auto 0;
position: relative; position: relative;
@ -435,21 +440,21 @@ http://sourceforge.net/adobe/cmap/wiki/License/
color: hsl(0, 0%, 85%); color: hsl(0, 0%, 85%);
font-size: 16px; font-size: 16px;
line-height: 20px; line-height: 20px;
} }
#mozPrintCallback-shim .progress-row { #mozPrintCallback-shim .progress-row {
clear: both; clear: both;
padding: 1em 0; padding: 1em 0;
} }
#mozPrintCallback-shim progress { #mozPrintCallback-shim progress {
width: 100%; width: 100%;
} }
#mozPrintCallback-shim .relative-progress { #mozPrintCallback-shim .relative-progress {
clear: both; clear: both;
float: right; float: right;
} }
#mozPrintCallback-shim .progress-actions { #mozPrintCallback-shim .progress-actions {
clear: both; clear: both;
} }
</style> </style>
<div class="mozPrintCallback-dialog-box"> <div class="mozPrintCallback-dialog-box">
&lt;!&ndash; TODO: Localise the following strings &ndash;&gt; &lt;!&ndash; TODO: Localise the following strings &ndash;&gt;
@ -464,6 +469,6 @@ http://sourceforge.net/adobe/cmap/wiki/License/
</div> </div>
</div> </div>
</body> </body>
</html> </html>

@ -38,15 +38,15 @@ var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading';
var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000; var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000;
PDFJS.imageResourcesPath = './images/'; PDFJS.imageResourcesPath = './images/';
PDFJS.workerSrc = '../build/pdf.worker.js'; PDFJS.workerSrc = '../build/pdf.worker.js';
PDFJS.cMapUrl = '../web/cmaps/'; PDFJS.cMapUrl = '../web/cmaps/';
PDFJS.cMapPacked = true; PDFJS.cMapPacked = true;
var mozL10n = document.mozL10n || document.webL10n; var mozL10n = document.mozL10n || document.webL10n;
var CSS_UNITS = 96.0 / 72.0; var CSS_UNITS = 96.0 / 72.0;
var DEFAULT_SCALE = 'auto'; var DEFAULT_SCALE = '1';
var UNKNOWN_SCALE = 0; var UNKNOWN_SCALE = 0;
var MAX_AUTO_SCALE = 1.25; var MAX_AUTO_SCALE = 1.25;
var SCROLLBAR_PADDING = 40; var SCROLLBAR_PADDING = 40;
@ -682,7 +682,7 @@ Preferences._readFromStorage = function (prefObj) {
// Also intercept Cmd/Ctrl + Shift + P in Chrome and Opera // Also intercept Cmd/Ctrl + Shift + P in Chrome and Opera
if (event.keyCode === 80/*P*/ && (event.ctrlKey || event.metaKey) && if (event.keyCode === 80/*P*/ && (event.ctrlKey || event.metaKey) &&
!event.altKey && (!event.shiftKey || window.chrome || window.opera)) { !event.altKey && (!event.shiftKey || window.chrome || window.opera)) {
//window.print(); window.print();
if (hasAttachEvent) { if (hasAttachEvent) {
// Only attachEvent can cancel Ctrl + P dialog in IE <=10 // Only attachEvent can cancel Ctrl + P dialog in IE <=10
// attachEvent is gone in IE11, so the dialog will re-appear in IE11. // attachEvent is gone in IE11, so the dialog will re-appear in IE11.
@ -7073,11 +7073,11 @@ function webViewerInitialized() {
/**document.getElementById('openFile').addEventListener('click', /**document.getElementById('openFile').addEventListener('click',
SecondaryToolbar.openFileClick.bind(SecondaryToolbar));*/ SecondaryToolbar.openFileClick.bind(SecondaryToolbar));*/
/*document.getElementById('print').addEventListener('click', document.getElementById('print').addEventListener('click',
SecondaryToolbar.printClick.bind(SecondaryToolbar)); SecondaryToolbar.printClick.bind(SecondaryToolbar));
document.getElementById('download').addEventListener('click', // document.getElementById('download').addEventListener('click',
SecondaryToolbar.downloadClick.bind(SecondaryToolbar));*/ // SecondaryToolbar.downloadClick.bind(SecondaryToolbar));
if (file && file.lastIndexOf('file:', 0) === 0) { if (file && file.lastIndexOf('file:', 0) === 0) {

Loading…
Cancel
Save