123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275 |
- $(document).ready(function() {
- // pdf容器contenterPdf
- var contenterPdf = $("#contenterPdf")
- var baseX = contenterPdf.offset().left
- var baseY = contenterPdf.offset().top
- // 每一页pdf
- var page_cell = contenterPdf.find(".page_cell")
- // pdf数据
- var pdfData = {
- "stdPoints":[],
- "titleInfo":{},
- "studentInfo":[],
- "studentNo":[],
- "noteInfo":[],
- "barCodeInfo":[],
- "missExamInfo":[],
- "objectiveQues":[]
- }
- Array.from(page_cell).forEach((item) => {
- console.log(item)
- // 标准点
- var std_points = $(".stdPoints")
- for(var i=0;i<std_points.length;i++){
- point = std_points.eq(i)
- console.log(point.offset(),2222222222)
- pdfData.stdPoints.push({
- x:point.offset().left-baseX,
- y:point.offset().top-baseY,
- w:point.width(),
- h:point.height()
- })
- }
- // 标题
- var titleInfo = $("#paperNameTextAreaTem")
- let pointObj = {}
- pointObj.x = titleInfo.offset().left-baseX
- pointObj.y = titleInfo.offset().top-baseY
- pointObj.w = titleInfo.width()
- pointObj.h = titleInfo.height()
- pdfData.titleInfo = pointObj
- // 考生信息
- let pointList = []
- // 姓名,下划线
- pointList.push({
- x:$("#name").offset().left-baseX,
- y:$("#name").offset().top-baseY,
- w:$("#name").width(),
- h:$("#name").height(),
- text:$("#name").text(),
- type:"text"
- })
- pointList.push({
- x:$("#nameLine").offset().left-baseX,
- y:$("#nameLine").offset().top-baseY,
- w:$("#nameLine").width(),
- h:$("#nameLine").height(),
- text:$("#nameLine").text(),
- type:"line"
- })
- // 班级,下划线
- pointList.push({
- x:$("#className").offset().left-baseX,
- y:$("#className").offset().top-baseY,
- w:$("#className").width(),
- h:$("#className").height(),
- text:$("#className").text()
- })
- pointList.push({
- x:$("#classNameLine").offset().left-baseX,
- y:$("#classNameLine").offset().top-baseY,
- w:$("#classNameLine").width(),
- h:$("#classNameLine").height(),
- text:$("#classNameLine").text(),
- type:"line"
- })
- // 考场号,下划线
- pointList.push({
- x:$("#kcNo").offset().left-baseX,
- y:$("#kcNo").offset().top-baseY,
- w:$("#kcNo").width(),
- h:$("#kcNo").height(),
- text:$("#kcNo").text()
- })
- pointList.push({
- x:$("#kcNoLine").offset().left-baseX,
- y:$("#kcNoLine").offset().top-baseY,
- w:$("#kcNoLine").width(),
- h:$("#kcNoLine").height(),
- text:$("#kcNoLine").text(),
- type:"line"
- })
- // 座位号,下划线
- pointList.push({
- x:$("#sitNo").offset().left-baseX,
- y:$("#sitNo").offset().top-baseY,
- w:$("#sitNo").width(),
- h:$("#sitNo").height(),
- text:$("#sitNo").text(),
- })
- pointList.push({
- x:$("#sitNoLine").offset().left-baseX,
- y:$("#sitNoLine").offset().top-baseY,
- w:$("#sitNoLine").width(),
- h:$("#sitNoLine").height(),
- text:$("#sitNoLine").text(),
- type:"line"
- })
- pdfData.studentInfo = pointList
- // 准考证号和填涂框
- pointList = []
- pointList.push({
- x:$("#zkzh").offset().left-baseX,
- y:$("#zkzh").offset().top-baseY,
- w:$("#zkzh").width(),
- h:$("#zkzh").height(),
- type:"text"
- })
- for(var i=0;i<$(".zkzh_rect").length;i++){
- pointList.push({
- x:$(".zkzh_rect").eq(i).offset().left-baseX,
- y:$(".zkzh_rect").eq(i).offset().top-baseY,
- w:$(".zkzh_rect").eq(i).width(),
- h:$(".zkzh_rect").eq(i).height(),
- type:"rect"
- })
- }
- pdfData.studentNo = pointList
- // 注意事项
- pointList = []
- pointList.push({
- x:$("#noteInfo").offset().left-baseX,
- y:$("#noteInfo").offset().top-baseY,
- w:$("#noteInfo").width(),
- h:$("#noteInfo").height(),
- type:"rect"
- })
- pointList.push({
- x:$("#noteInfo_title").offset().left-baseX,
- y:$("#noteInfo_title").offset().top-baseY,
- w:$("#noteInfo_title").width(),
- h:$("#noteInfo_title").height(),
- type:"text",
- text:$("#noteInfo_title").text()
- })
- for(var i=0;i<$(".noteInfo_desc").length;i++){
- pointList.push({
- x:$(".noteInfo_desc").eq(i).offset().left-baseX,
- y:$(".noteInfo_desc").eq(i).offset().top-baseY,
- w:$(".noteInfo_desc").eq(i).width(),
- h:$(".noteInfo_desc").eq(i).height(),
- type:"text",
- text:$(".noteInfo_desc").eq(i).text()
- })
- }
- pdfData.noteInfo = pointList
- // 条形码区域
- pointList = []
- pointList.push({
- x:$("#barCodeRect").offset().left-baseX,
- y:$("#barCodeRect").offset().top-baseY,
- w:$("#barCodeRect").width(),
- h:$("#barCodeRect").height(),
- type:"rect"
- })
- pointList.push({
- x:$("#barCodeTitle").offset().left-baseX,
- y:$("#barCodeTitle").offset().top-baseY,
- w:$("#barCodeTitle").width(),
- h:$("#barCodeTitle").height(),
- type:"text",
- text:$("#barCodeTitle").text()
- })
- pointList.push({
- x:$("#barCodeNote").offset().left-baseX,
- y:$("#barCodeNote").offset().top-baseY,
- w:$("#barCodeNote").width(),
- h:$("#barCodeNote").height(),
- type:"text",
- text:$("#barCodeNote").text()
- })
- pdfData.barCodeInfo = pointList
-
- // 缺考标记
- pointList = []
- pointList.push({
- x:$("#missExamRect").offset().left-baseX,
- y:$("#missExamRect").offset().top-baseY,
- w:$("#missExamRect").width(),
- h:$("#missExamRect").height(),
- type:"rect"
- })
- pointList.push({
- x:$("#exactFill").offset().left-baseX,
- y:$("#exactFill").offset().top-baseY,
- w:$("#exactFill").width(),
- h:$("#exactFill").height(),
- type:"text",
- text:$("#exactFill").text()
- })
- pointList.push({
- x:$("#exactFillRect").offset().left-baseX,
- y:$("#exactFillRect").offset().top-baseY,
- w:$("#exactFillRect").width(),
- h:$("#exactFillRect").height(),
- type:"rect",
- })
- pointList.push({
- x:$("#missExamFill").offset().left-baseX,
- y:$("#missExamFill").offset().top-baseY,
- w:$("#missExamFill").width(),
- h:$("#missExamFill").height(),
- type:"text",
- text:$("#missExamFill").text()
- })
- pointList.push({
- x:$("#missExamFillRect").offset().left-baseX,
- y:$("#missExamFillRect").offset().top-baseY,
- w:$("#missExamFillRect").width(),
- h:$("#missExamFillRect").height(),
- type:"rect"
- })
- pdfData.missExamInfo = pointList
- // 客观题
- pointList = []
- // 客观题标题
- pointList.push({
- x:$("#page_objective_title").offset().left-baseX,
- y:$("#page_objective_title").offset().top-baseY,
- w:$("#page_objective_title").width(),
- h:$("#page_objective_title").height(),
- type:"text",
- text:$("#page_objective_title").text()
- })
- // 客观题矩形区域
- pointList.push({
- x:$("#page_objective_rect").offset().left-baseX,
- y:$("#page_objective_rect").offset().top-baseY,
- w:$("#page_objective_rect").width(),
- h:$("#page_objective_rect").height(),
- type:"rext"
- })
- // 客观题选项
- $(".page_objective_ques").forEach(item=>{
- let tmid = $(item).find(".page_cell_tm_id").eq(0);
- let tmoptions = $(item).find(".page_cell_tm_id");
- pointList.push({
- x:tmid.offset().left-baseX,
- y:tmid.offset().top-baseY,
- w:tmid.width(),
- h:tmid.height(),
- type:"text",
- text:tmid.text()
- })
- for(var i=0;i<tmoptions.length;i++){
- pointList.push({
- x:tmoptions.eq(i).offset().left-baseX,
- y:tmoptions.eq(i).offset().top-baseY,
- w:tmoptions.eq(i).width(),
- h:tmoptions.eq(i).height(),
- type:"rext"
- })
- }
- })
- pdfData.objectiveQues = pointList
- });
- console.log(pdfData,33333333333333)
- })
|