国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁(yè) > news >正文

wordpress的用戶名密碼網(wǎng)站優(yōu)化seo培

wordpress的用戶名密碼,網(wǎng)站優(yōu)化seo培,廈門專業(yè)做網(wǎng)站公司,wordpress配置數(shù)據(jù)庫(kù)文件前言 最近公司讓寫一個(gè)數(shù)據(jù)頁(yè)面生成pdf的功能,找了一些市面代碼感覺(jué)都太麻煩,就自己綜合性整合了一個(gè)便捷的工具類,開發(fā)只需簡(jiǎn)單組裝數(shù)據(jù)直接調(diào)用即可快速生成pdf文件。望大家一起學(xué)習(xí)!!! 代碼獲取方式&am…

前言

最近公司讓寫一個(gè)數(shù)據(jù)頁(yè)面生成pdf的功能,找了一些市面代碼感覺(jué)都太麻煩,就自己綜合性整合了一個(gè)便捷的工具類,開發(fā)只需簡(jiǎn)單組裝數(shù)據(jù)直接調(diào)用即可快速生成pdf文件。望大家一起學(xué)習(xí)!!!
代碼獲取方式:

  1. 資源下載
  2. 后臺(tái)私信(一鍵三連哦!!!)

二、前期準(zhǔn)備

1、html模版(放置接口所在項(xiàng)目的resourcess/templates/

需要準(zhǔn)備一個(gè)要看到的pdf模版,利用html代碼形式簡(jiǎn)單輸出,其中需要?jiǎng)討B(tài)填充的地方需要用變量進(jìn)行填充
比如頁(yè)面顯示:
姓名:韓云中
性別:男

<div>姓名:${name}性別:${sex}
</div>

2、數(shù)據(jù)實(shí)體

AbstractDocumentVo 必須繼承 會(huì)有個(gè)findPrimaryKey方法需要實(shí)現(xiàn),return一個(gè)你這條數(shù)據(jù)的標(biāo)識(shí)即可
實(shí)體字段名稱必須與html${}內(nèi)容一致

public class User extends AbstractDocumentVo {private String name;private String sex;@Overridepublic String findPrimaryKey() {// 數(shù)據(jù)標(biāo)識(shí)  id或則其它均可return this.name;}
}

三、代碼開發(fā)

實(shí)現(xiàn)接口

@GetMapping("/testCreatePdf")
public void testCreatePdf(HttpServletResponse response) {// 方式一:前端直接給你傳遞這個(gè)對(duì)象// 方式二:通過(guò)前端傳遞的標(biāo)識(shí),自行去庫(kù)中進(jìn)行數(shù)據(jù)獲取// ** 兩種方式都需要保證html用到的字段不能存在null 不然報(bào)錯(cuò)User user = new User();user.setName("");user.setSex("");// 生成pdf路徑PdfDocumentGenerator pdfGenerator = new PdfDocumentGenerator();// 生成pdf  // 參數(shù)一:classpath中templates下對(duì)應(yīng)要用的模版名稱 // 參數(shù)二:模板數(shù)據(jù) // 參數(shù)三:生成pdf名稱// 參數(shù)四:responsepdfGenerator.generate("overseaAssistance.html", overseaVo, "2.pdf", response);
}

四、結(jié)果

得到自己想要的pdf文件
在這里插入圖片描述

測(cè)試數(shù)據(jù)

java實(shí)體

package com.yxy.aob.controller;import com.yxy.common.core.utils.file.pdf.AbstractDocumentVo;
import lombok.Data;
import lombok.EqualsAndHashCode;/*** @Description:* @Author: Hyz* @Date: 2024/10/11 11:22* @Version:1.0*/
@EqualsAndHashCode(callSuper = true)
@Data
public class OverseaVo extends AbstractDocumentVo {/*** 標(biāo)識(shí)*/private String policyNo;/*** 投保人姓名*/private String holderName;/*** 投被保人關(guān)系*/private String relation;/*** 投保人聯(lián)絡(luò)地址*/private String holderAdress;/*** 投保人郵編*/private String holderPostCode;/*** 被保險(xiǎn)人姓名*/private String insuredName;/*** 被保險(xiǎn)人姓名拼音*/private String insuredPingyinName;/*** 被保險(xiǎn)人護(hù)照號(hào)碼*/private String insuredPassportNo;/*** 被保險(xiǎn)人性別*/private String insuredSex;/*** 被保險(xiǎn)人出生日期*/private String insuredBirthday;/*** 被保險(xiǎn)人電話*/private String insuredPhone;/*** 被保險(xiǎn)人證件號(hào)碼*/private String insuredIDNo;/*** 前往國(guó)家或地區(qū)*/private String destination;/*** 受益人姓名*/private String beneficiaryName;/*** 備注*/private String remarks;/*** 保險(xiǎn)期間*/private String period;/*** 境外意外傷害或殘疾保額*/private String accidentalSumInsured;/*** 緊急救援醫(yī)療保額*/private String emergencySumInsured;/*** 附加境外緊急救援醫(yī)保額*/private String medicalSumInsured;/*** 總保費(fèi)*/private String premium;/*** 簽發(fā)日期*/private String issueDate;/*** 省份*/private String branchName;/*** 合作公司名稱*/private String companyName;@Overridepublic String findPrimaryKey() {return this.policyNo;}
}

html模版

<html>
<head><title></title><style type="text/css">body {margin-left: 45px;margin-right: 45px;font-family: Arial Unicode MS;font-size: 10px;}table {margin: auto;width: 100%;border-collapse: collapse;border: 1px solid #444444;}th,td {border: 1px solid #444444;font-size: 10px;margin-left: 5px;}.mcContent {line-height: 180%;padding: 20px;}.logo {text-align: center;}.title {text-align: center;font-weight: bold;font-size: 20px;}.notes {font-weight: normal;margin-left: 5px;margin-right: 5px;line-height: 18px;}.text_content {margin-left: 5px;margin-right: 5px;line-height: 18px;}.sum_insured_first_row {width: 20%;}.sum_insured_span {font-size: 10px;}.special_agreements_div {page-break-before: always;font-size: 14px;margin-top: 20px;}.special_agreements_div .special_agreements {font-size: 18px;font-weight: bold;}.title_right {width: 100%;margin: 0 auto;}.title_right p {text-align: left;margin: 0;margin-left: 50%;padding: 0;}@page {size: 8.5in 11in;@bottom-center{content:"page "counter(page)" of  "counter(pages);}.signature {margin: 0 auto;clear: both;font-size: 16px;font-weight: bold;}.signature_table {/*     font-size: 16px; */font-weight: bold;}</style>
</head>
<body>
<div><div class="title">測(cè)試PDF生成--<p>測(cè)試單號(hào):${policyNo}</p></div><div class="insurance_info"><table class="insurance_info_table" cellpadding="0" cellspacing="0"width="100%"><tr><td width="20%" colspan="3">投保人<br /> Policyholder</td><td width="43%" colspan="3">${holderName}<br /></td><td width="15%">與被保險(xiǎn)人關(guān)系<br /> Relationship with the Insured</td><td >${relation}</td></tr><tr><td width="20%" colspan="3">聯(lián)絡(luò)地址<br /> Correspondence Address</td><td width="43%" colspan="3">${holderAdress}</td><td width="15%">郵編<br /> Postal Code</td><td >${holderPostCode}</td></tr><tr class="td_width1"><td width="20%" colspan="3">被保險(xiǎn)人姓名<br /> Name of the Insured</td><td width="13%">${holderName}</td><td width="10%">(拼音)<br /> (Pinyin)</td><td width="18%">${insuredPingyinName}</td><td width="15%">護(hù)照號(hào)碼<br /> Passport No</td><td>${insuredPassportNo}</td></tr><tr><td width="5%">性別<br /> Sex</td><td width="5%">${insuredSex}</td><td width="10%">出生日期<br /> Date of Birth</td><td width="13%">${insuredBirthday}</td><td width="10%">電話<br /> Telephone No.</td><td width="18%">${insuredPhone}</td><td width="15%">證件號(hào)碼 <br />ID No.</td><td >${insuredIDNo}</td></tr><tr><td colspan="3">請(qǐng)?jiān)敿?xì)列明前往國(guó)家或地區(qū)<br /> Destination</td><td colspan="3">${destination}</td><td>受益人姓名<br /> Beneficiary</td><td>${beneficiaryName}</td></tr><tr><td class="address_class" colspan="3">備注 <br /> Remarks</td><td colspan="5">${remarks}</td></tr><tr><td class="address_class" colspan="3">保險(xiǎn)期間 <br /> Insuranceperiod</td><td colspan="5">${period}</td></tr></table></div><div class="signature"><br /> <br /><table class="signature_table" style="border: 0; width: 100%;"><tr><thstyle="border: 0; font-size: 12px; font-weight: bold; text-align: left; width: 17%;">總經(jīng)理簽名:<br /> <span style="font-size:10px">Authorized Signature</span></th><tdstyle="border: 0; font-size: 12px; font-weight: bold; text-align: left; width: 17%;"></td><thstyle="border: 0; font-size: 12px; font-weight: bold; text-align: left; width: 17%;">公司簽章:<br /><span style="font-size:10px">Company Stamp</span></th><tdstyle="border: 0; font-size: 12px; font-weight: bold; text-align: left; width: 17%;"></td><thstyle="border: 0; font-size: 12px; font-weight: bold; text-align: left; width: 16%;">簽發(fā)日期:<br /><span style="font-size:10px">Issue Date</span></th><tdstyle="border: 0; font-size: 12px; font-weight: bold; text-align: left; width: 16%;">${issueDate}</td></tr></table></div><div class="text_content"><br /> 我從來(lái)不是那樣的人,不能耐心地拾起一地碎片,把它們湊合在一起,然后對(duì)自己說(shuō),這個(gè)修補(bǔ)好了的東西,跟新的完全一樣。一樣?xùn)|西破碎了就是破碎了,我寧愿記住它最好時(shí)的模樣,而不想把它修補(bǔ)好,然后終生看著那些碎了的地方。</div></div>
</body>
</html>
http://aloenet.com.cn/news/37294.html

相關(guān)文章:

  • 郴州建設(shè)網(wǎng)站贛州網(wǎng)站seo
  • 杭州外貿(mào)網(wǎng)站制作網(wǎng)推資源渠道
  • 做網(wǎng)站用哪個(gè)office推廣普通話文字內(nèi)容
  • 類似WordPress的Pythonseo網(wǎng)站優(yōu)化工具大全
  • 附近做app的公司重慶seo論壇
  • 網(wǎng)站建設(shè)經(jīng)費(fèi)立項(xiàng)報(bào)告網(wǎng)絡(luò)營(yíng)銷發(fā)展方案策劃書
  • 那個(gè)網(wǎng)站可以做視頻app制作的企業(yè)網(wǎng)站建設(shè)方案模板
  • 網(wǎng)站要交錢嗎電腦培訓(xùn)學(xué)校哪家好
  • 手機(jī)微網(wǎng)站怎么做的網(wǎng)絡(luò)軟文營(yíng)銷案例3篇
  • 西安網(wǎng)站建設(shè)公司云網(wǎng)北京網(wǎng)站優(yōu)化排名推廣
  • 張家港高端網(wǎng)站制作百度總部公司地址在哪里
  • 蘇州 網(wǎng)站 建設(shè) 公司微信營(yíng)銷模式有哪些
  • 做企業(yè)網(wǎng)站比較好的公司互動(dòng)營(yíng)銷案例都有哪些
  • 建筑工程網(wǎng)站源碼市場(chǎng)營(yíng)銷證書含金量
  • 天津高端品牌網(wǎng)站建設(shè)企業(yè)培訓(xùn)課程名稱大全
  • 網(wǎng)站開發(fā)畢業(yè)論文范文微博推廣方法有哪些
  • 自適應(yīng)網(wǎng)站什么做2022今天剛剛發(fā)生地震了
  • 哈爾濱住房和城鄉(xiāng)建設(shè)廳官方網(wǎng)站如何軟件網(wǎng)站優(yōu)化公司
  • wordpress 數(shù)據(jù)庫(kù)青島網(wǎng)站關(guān)鍵詞排名優(yōu)化
  • 政府網(wǎng)站建設(shè)情況調(diào)查表內(nèi)蒙古seo
  • 汽車app網(wǎng)站建設(shè)內(nèi)容企業(yè)推廣
  • h5長(zhǎng)圖怎么做口碑優(yōu)化
  • windows系統(tǒng)做網(wǎng)站滄州網(wǎng)站建設(shè)優(yōu)化公司
  • html+jsp個(gè)人網(wǎng)站模板百度認(rèn)證證書
  • 北京網(wǎng)站建設(shè)工作室百度的合作網(wǎng)站有哪些
  • 谷歌網(wǎng)站收錄入口seo優(yōu)化的常用手法
  • 岳陽(yáng)企業(yè)網(wǎng)站定制開發(fā)如何在百度上開店鋪
  • 好的h5網(wǎng)站企業(yè)網(wǎng)站模板免費(fèi)下載
  • 政府網(wǎng)站建設(shè)計(jì)劃編程培訓(xùn)
  • 金融業(yè)反洗錢培訓(xùn)網(wǎng)站seo咨詢推廣