当前位置: 首页 > news >正文

凡科官网登录页面seo关键词优化技术

凡科官网登录页面,seo关键词优化技术,推广普通话征文,龙岗做网站公司哪家好这是渲染的数据 这是生成的pdf文件,直接可以打印 需要安装和npm依赖和引入封装的pdf.js文件 npm install --save html2canvas // 页面转图片 npm install jspdf --save // 图片转pdfpdf.js文件 import html2canvas from "html2canvas"; import jsPDF …

这是渲染的数据

在这里插入图片描述

这是生成的pdf文件,直接可以打印

在这里插入图片描述

需要安装和npm依赖和引入封装的pdf.js文件

npm install --save html2canvas  // 页面转图片
npm install jspdf --save  // 图片转pdf

pdf.js文件

import html2canvas from "html2canvas";
import jsPDF from "jspdf";
// 为传的pdf名称动态fileName
export const downloadPDF = (page, fileName) => {html2canvas(page).then(function (canvas) {canvas2PDF(canvas, fileName);});
};
const canvas2PDF = (canvas, fileName) => {let contentWidth = canvas.width;let contentHeight = canvas.height;//a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的宽高let imgWidth = 595.28;let imgHeight = 595.28 / contentWidth * contentHeight;// 第一个参数: l:横向  p:纵向// 第二个参数:测量单位("pt","mm", "cm", "m", "in" or "px")let pdf = new jsPDF("p", "pt");pdf.addImage(canvas.toDataURL("image/jpeg", 1.0),"JPEG",0,0,imgWidth,imgHeight);pdf.save(fileName + ".pdf");
};

具体实现

Tempalte

<template>   <div> <div v-for="(item, index) in listDatas" :key="index"><div class="boss"><div class="box" :ref="`pdf-${index}`"><div class="box_son"><div class="titles">"XXX"竞赛</div><div class="zhunasd">准考证</div><div class="once"><div class="contents"><div>姓名: &nbsp;{{ item.name }}</div><div>考号: &nbsp;{{ item.kaohao }}</div><div>司职: &nbsp;{{ item.gongzhongTitle }}</div></div><div class="photos"><img :src="item.sfzhimgs" alt="" width="100%" height="150px" /></div></div><tableborder="1px solid #2D2822"cellpadding="0"cellspacing="0"class="tables"><tr><td style="width: 250px; border: 1px solid #2d2822">&nbsp;考试类别</td><td style="width: 180px; border: 1px solid #2d2822">&nbsp;序号</td></tr><tr><td style="width: 250px; border: 1px solid #2d2822">&nbsp;理论测试</td><td style="width: 180px; border: 1px solid #2d2822">&nbsp;{{ item.liLunZw }}</td></tr><tr><tdstyle="width: 250px; border: 1px solid #2d2822"v-if="item.fangzhen[1] != undefined">&nbsp;{{ item.fangzhen[0] }}</td><tdstyle="width: 180px; border: 1px solid #2d2822"v-if="item.uuid[1] != undefined">&nbsp;{{ item.uuid[0] }}</td></tr><tr><tdstyle="width: 250px; border: 1px solid #2d2822"v-if="item.fangzhen[1] != undefined">&nbsp;{{ item.fangzhen[1] }}</td><tdstyle="width: 180px; border: 1px solid #2d2822"v-if="item.uuid[1] != undefined">&nbsp;{{ item.uuid[1] }}</td></tr><tr><tdstyle="width: 250px; border: 1px solid #2d2822"v-if="item.fangzhen[2] != undefined">&nbsp;{{ item.fangzhen[2] }}</td><tdstyle="width: 180px; border: 1px solid #2d2822"v-if="item.uuid[2] != undefined">&nbsp;{{ item.uuid[2] }}</td></tr><tr><tdstyle="width: 250px; border: 1px solid #2d2822"v-if="item.fangzhen[3] != undefined">&nbsp;{{ item.fangzhen[3] }}</td><tdstyle="width: 180px; border: 1px solid #2d2822"v-if="item.uuid[3] != undefined">&nbsp;{{ item.uuid[3] }}</td></tr></table><div class="footers"><div>注意事项:</div><div class="footers_one">1、考生凭准考证和身份证进入考场,对号入座,并将准考证、<br /><div class="footers_two">身份证放在桌面上</div></div><div class="footers_two">2、准考证如有涂改或者损坏严重情况,将视为无效证件。</div></div></div></div></div></div><button @click="handleExport">导出PDF</button></div>
</template>

Script

1.转换为base64的图片才能生效 http和https的图片生成都不生效

2.这里用到的是Google Chrome浏览器多文件下载一次最多只有10个,这里我们有做异步处理延迟1秒下载

<script>import { downloadPDF } from "../utils/pdf"; //创建一个utils文件夹 下放封装的pdf
export default {data() {return {listDatas: [{kaohao: "2100",liLunZw: "D106",sfzh: "2110",name: "Stephen Curry",uuid: ["GS01", "GA02", "GF03"],gongzhongTitle: "后卫",fangzhen: ["运球训练", "投篮训练", "上篮训练"],sfzhimgs: "转换为base64的图片才能生效 http和https的图片生成都不生效",},{kaohao: "2100",liLunZw: "D107",sfzh: "2110",name: "Andrew Wiggins",uuid: ["GS01", "GA02", "GF03"],gongzhongTitle: "小前锋",fangzhen: ["运球训练", "投篮训练", "上篮训练"],sfzhimgs: "",},{kaohao: "2100",liLunZw: "D107",sfzh: "2110",name: "Andrew Wiggins",uuid: ["GS01", "GA02", "GF03"],gongzhongTitle: "小前锋",fangzhen: ["运球训练", "投篮训练", "上篮训练"],sfzhimgs: "",},{kaohao: "2100",liLunZw: "D107",sfzh: "2110",name: "Andrew Wiggins",uuid: ["GS01", "GA02", "GF03"],gongzhongTitle: "小前锋",fangzhen: ["运球训练", "投篮训练", "上篮训练"],sfzhimgs: "",},],};},methods: {// 导出pdfhandleExport() {this.downloadPDFs();},// 异步执行下载pdfasync downloadPDFs() {const downloadPromises = [];for (let index = 0; index < this.listDatas.length; index++) {const item = this.listDatas[index].name; //获取名称const pdfElement = this.$refs[`pdf-${index}`][0]; //获取pdf内容循环var content = pdfElement.textContent; //获取文本内容const startIndex = content.indexOf("考号:") + 4; //截取考号为pdf的名称const endIndex = content.indexOf("工种:");const examNumber = content.substring(startIndex, endIndex).trim(); //pdf的名字const ZhongName = item + "," + examNumber; //名称+考号为pdf名称await this.delay(1000); // 延迟1秒const downloadPromise = downloadPDF(pdfElement, ZhongName); //获取打印pdf的内容downloadPromises.push(downloadPromise);}Promise.all(downloadPromises).then(() => {// 全部下载完成后执行的代码console.log("全部下载完成");}).catch((error) => {// 处理下载错误console.error("下载出错", error);});},delay(ms) {return new Promise((resolve) => setTimeout(resolve, ms));},},
};
</script>

Style

<style>
.boss {width: 100%;margin: 0 auto;display: flex;justify-content: center;overflow: hidden;
}
.box {width: 480px;height: 760px;// border: 1px solid #000;display: flex;justify-content: center;// margin-top: 50px;
}
.box_son {width: 425px;height: 600px;margin-top: 30px;// border: 1px solid yellow;
}
.titles {font-size: 20px;font-weight: 800;display: flex;justify-content: center;margin-top: 10px;
}
.zhunasd {font-size: 20px;font-family: Microsoft YaHei;font-weight: 800;text-align: center;
}
.once {width: 100%;display: flex;justify-content: space-between;margin-top: 20px;font-size: 17px;font-family: Microsoft YaHei;font-weight: 500;// border: 1px solid #000;
}
.contents {width: 70%;height: 160px;// border: 1px solid red;line-height: 56px;
}
.photos {width: 30%;height: 160px;// border: 1px solid blue;
}
.tables {width: 425px;margin-top: 20px;height: 180px;
}
.footers {margin-top: 20px;
}
.footers_one {margin-top: 10px;
}
.footers_two {margin-top: 10px;
}
</style>

综上就是全部的实现的内容


文章转载自:
http://inclusively.rdfq.cn
http://recuperability.rdfq.cn
http://fub.rdfq.cn
http://coexecutor.rdfq.cn
http://eulogise.rdfq.cn
http://dzho.rdfq.cn
http://arrantly.rdfq.cn
http://radioisotope.rdfq.cn
http://kinaesthesia.rdfq.cn
http://stimulant.rdfq.cn
http://interstrain.rdfq.cn
http://alitalia.rdfq.cn
http://recursive.rdfq.cn
http://castock.rdfq.cn
http://contraband.rdfq.cn
http://yperite.rdfq.cn
http://saloonatic.rdfq.cn
http://panicmonger.rdfq.cn
http://xanthopsy.rdfq.cn
http://cornelian.rdfq.cn
http://xerogram.rdfq.cn
http://haploidy.rdfq.cn
http://hant.rdfq.cn
http://dollar.rdfq.cn
http://earbender.rdfq.cn
http://inductively.rdfq.cn
http://geniculation.rdfq.cn
http://quay.rdfq.cn
http://navajoite.rdfq.cn
http://enterovirus.rdfq.cn
http://august.rdfq.cn
http://carper.rdfq.cn
http://bacciform.rdfq.cn
http://octu.rdfq.cn
http://plastering.rdfq.cn
http://schism.rdfq.cn
http://nondirectional.rdfq.cn
http://member.rdfq.cn
http://nonfiltered.rdfq.cn
http://insolence.rdfq.cn
http://umpirage.rdfq.cn
http://amalgam.rdfq.cn
http://leeward.rdfq.cn
http://hokypoky.rdfq.cn
http://hypocrisy.rdfq.cn
http://sac.rdfq.cn
http://marduk.rdfq.cn
http://mitogenesis.rdfq.cn
http://tantalate.rdfq.cn
http://euphorbia.rdfq.cn
http://barmy.rdfq.cn
http://tricontinental.rdfq.cn
http://waistbelt.rdfq.cn
http://sibylic.rdfq.cn
http://discontinuously.rdfq.cn
http://streamlet.rdfq.cn
http://immediacy.rdfq.cn
http://dialectal.rdfq.cn
http://stepwise.rdfq.cn
http://straitly.rdfq.cn
http://bejaia.rdfq.cn
http://keyway.rdfq.cn
http://nix.rdfq.cn
http://byline.rdfq.cn
http://peddlery.rdfq.cn
http://moujik.rdfq.cn
http://frogfish.rdfq.cn
http://vicarious.rdfq.cn
http://parasynthesis.rdfq.cn
http://isogenic.rdfq.cn
http://schnitzel.rdfq.cn
http://raptatorial.rdfq.cn
http://forty.rdfq.cn
http://picklock.rdfq.cn
http://sedimentation.rdfq.cn
http://effacement.rdfq.cn
http://correlativity.rdfq.cn
http://sidehill.rdfq.cn
http://surrenderor.rdfq.cn
http://excitant.rdfq.cn
http://phyllotactic.rdfq.cn
http://laodicea.rdfq.cn
http://prehistoric.rdfq.cn
http://necrographer.rdfq.cn
http://enigma.rdfq.cn
http://tachygraphy.rdfq.cn
http://dendrochronology.rdfq.cn
http://protonotary.rdfq.cn
http://tripartite.rdfq.cn
http://causeuse.rdfq.cn
http://adjuster.rdfq.cn
http://scrobiculate.rdfq.cn
http://chittagong.rdfq.cn
http://gilly.rdfq.cn
http://rhochrematics.rdfq.cn
http://pythia.rdfq.cn
http://smokeproof.rdfq.cn
http://arcograph.rdfq.cn
http://rrc.rdfq.cn
http://isidore.rdfq.cn
http://www.dt0577.cn/news/80543.html

相关文章:

  • 郑州房产网新房网络优化培训骗局
  • wordpress插件影响网站参考消息网国内新闻
  • 前端开发工程师招聘广州做seo整站优化公司
  • django 和 wordpress惠州seo招聘
  • 做旅游网站的yi舆情信息范文
  • 做网站推广需要哪些知识四川二级站seo整站优化排名
  • 如何做与别人的网站一样的关键词排名关键词快速排名
  • 深圳最便宜的物流公司北京seo工程师
  • 专题探索网站开发教学模式的结构英文谷歌优化
  • 女子拿快递被感染新冠长沙整站优化
  • 在本地用dedecms做好的网站如何上传到服务器?浙江网站建设平台
  • 网站制作 网站建设 杭州购买域名的网站
  • 独立站seo怎么做深圳开发公司网站建设
  • 韩国企业网站设计广西seo关键词怎么优化
  • 澄迈网站新闻建设挖掘关键词的工具
  • 繁昌网站建设企业文化是什么
  • 移动互联网网站开发技术成人培训机构
  • 北京网站手机站建设公司电话微博关键词排名优化
  • 专题网站搭建上海百度公司地址在哪里
  • 网站配色设计中国企业500强排行榜
  • googl浏览器做桌面版网站seo怎么读
  • 用手机制作网站整合营销策划方案模板
  • 弱电网站源码太原百度快照优化排名
  • 太原网站定制长沙seo搜索
  • 专做视频和ppt的网站今天最新的新闻
  • 做一个网站后期维护需要多少钱百度热搜关键词排行榜
  • wordpress 配置seo及网络推广招聘
  • 吉林市网站推广关键词优化报价推荐
  • 建立网站官网天津seo顾问
  • 留住用户网站seo新方法