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

响应式网站的特点安装wordpress时出现空白

响应式网站的特点,安装wordpress时出现空白,京东商城网站建设教程,Wordpress. Redisspringboot 动态导出pdf 原理是通过freemarker插入数据到html模版里面#xff0c;html你就叫前端帮你写好#xff0c;他不写你就告诉你主管让他叫他写#xff0c;你只管往预留的位置插入数据就行#xff0c;然后通过itextpdf会将准备好html文件转成PDF。 ### 1、准备依赖 html你就叫前端帮你写好他不写你就告诉你主管让他叫他写你只管往预留的位置插入数据就行然后通过itextpdf会将准备好html文件转成PDF。 ### 1、准备依赖 !--下载pdf begin--dependencygroupIdcom.itextpdf/groupIdartifactIdhtml2pdf/artifactIdversion4.0.3/version/dependency!-- freemarker模版 --dependencygroupIdorg.freemarker/groupIdartifactIdfreemarker/artifactIdversion2.3.30/version/dependency!--下载pdf end--### 2、准备html模版 html headmeta charsetUTF-8style.main-container {font-family: SF-UI-Text-Regular;width: 21cm;margin: 0 auto;padding: 20px;}.float-left {float: left;}.float-right {float: right;}.padding-left-right {padding-left: 20px;padding-right: 20px;}.margin-left-right {margin-left: 20px;margin-right: 20px;}.section {/*border: 3px dashed #CCC;*//*padding: 20px;*/border-Top: 2px dashed #D3D3D3;padding-Top: 13px;margin-bottom: 16px;margin-Top: 20px;}.section-details p {color: #126089;/*font-size: 16px;*/}.grouper {overflow: hidden;}.grid-50 {width: 50%;}font-face {font-family: SF-UI-Text-Regular;src: url(https://s3-ap-southeast-1.amazonaws.com/content.staging.whitecoat.global/PDF/Templates/fonts/SF-UI-Text-Regular.otf);font-style: normal;}h1 {font-size: 22px;font-family: SF-UI-Text-Regular;}.h1-main {margin-top: 90px;}p {margin: 0 0 10px 0;font-family: SF-UI-Text-Regular;font-size: 12px;}.p-spec {color: #149a9a;font-weight: bold;}table, th, td {padding: 5px;border-collapse: collapse;}th, td {border: 1px solid #D3D3D3;}.margin-b-30 {margin-bottom: 30px;}.row:after {content: ;display: table;clear: both;}.column-4 {float: left;width: 33.33%;padding: 10px;}.column-8 {float: left;width: 66.66%;padding: 10px;}* {box-sizing: border-box;font-size: 12px;}/style /head bodydiv classmain-containerdiv stylebackground-color: #fffdiv classgrouper main-header grouper padding-left-right stylepadding-top: 20pxdiv classmargin-b-30 rowdiv classcolumn-4img stylemax-width:90%srchttps://s3-ap-southeast-1.amazonaws.com/content.staging.whitecoat.global/PDF/Templates/Images/WhiteCoat_Tax_Invoice.png/divdiv classcolumn-4WhiteCoat Holdings Pte Ltd. br/Clinic Licence No.: 18M0119/01/182 br/201 Henderson Road #05-11/12 br/Apex Henderson br/Singapore 159545 br//divdiv classcolumn-4GST Reg. No: 201610235E br/T: 65 6909 6909 br/F: 65 6909 6909 br/E: contactuswhitecoat.com.sg br/a styletext-decoration: none; hrefhttps://whitecoat.com.sg/whitecoat.com.sg/a/div/div/divdiv classmain-bodydiv classgrouperdiv classgrouper margin-left-right row styleborder-Top: 1px solid #D3D3D3;padding-top:20px;div classcolumn-4Name: br/${data.name!} br/br/NRIC/FIN/Passport No: br/${data.idNo!}/divdiv classcolumn-8Invoice No.: br/${data.invoiceNo!} br/br/Invoice Date: br/${data.invoiceDateStr!} br/br/iThis is a computer generated invoice. No signature is required./i/div/divdiv classgrouper margin-left-right styleborder-Top: 1px solid #D3D3D3;padding-top:20px;tabletrthS/N/thth colspan2Description/thth styleborder:1px solid #D3D3D3;Amount/th/trtrtd stylewidth:30px;text-align:center;1/tdtd stylewidth:550px; border-right: noneMedication br/#list data.medicationList as item${item.productName!} br//#listibr/Subtotal/i/tdtd styletext-align:right; border-left: noneQuantity br/#list data.medicationList as item${item.quantity!} br//#listi stylecolor:#fffbr/Subtotal/i/tdtd stylewidth:200px;text-align:rightbr/#list data.medicationList as item$${item.amount!} br//#listbr/i${data.subtotal!}/i/td/trtrtd styletext-align:center;2/tdtd colspan2Administrative charges/tdtd styletext-align:right$${data.adminCharge!}/td/trtrtd colspan3 styletext-align:right; border-bottom: none; border-left: noneSubtotal(Excluding GST)/tdtd styletext-align:right$${data.subtotalExcludingGST!}/td/trtrtd colspan3styletext-align:right; ; border-bottom: none; border-top: none; border-left: noneGST(${data.tax!}%)/tdtd styletext-align:right$${data.GST!}/td/trtrtd colspan3styletext-align:right; border-top: none; border-left: none; border-bottom: noneTotal(Including GST)/tdtd styletext-align:right$${data.totalIncludingGST!}/td/tr/table/divdiv classgrouper margin-left-right float-left stylepadding-bottom :20px;padding-top :20pxspanBank remittance details for payment by Bank Telegraphic br/Transfer in Singapore Dollars to:br/Name of Bank: United Overseas Bank Ltd. Holland Branchbr/Account Name: Whitecoat Holdings Pte Ltd.br/Account No: 341-308-316-6br/Bank Code: 7375br/Branch Code: 020br/Bank Swift Code: UOVBSGSG/span/div/div/div/div/body /html### 3、下载代码 ApiOperation(value 下载pdf)GetMapping(downloadPDF/staffPurchase)public ResponseResult download(String id, HttpServletResponse response) throws Exception {StaffPurchasePDFVo data staffPurchaseMapper.getStaffPurchasePDFData(id);HashMapString, Object mapData Maps.newHashMap();mapData.put(data, data);long timeMillis System.currentTimeMillis();String templateContent HtmlUtils.getTemplateContent(Staff_Purchase_Receipt.ftl, mapData);HtmlUtils.html2Pdf(response, templateContent, timeMillis );return ResponseResult.success();}### 4、htmlutils代码 import com.itextpdf.html2pdf.ConverterProperties; import com.itextpdf.html2pdf.HtmlConverter; import com.itextpdf.layout.font.FontProvider; import freemarker.template.Configuration; import freemarker.template.Template; import lombok.extern.slf4j.Slf4j; import org.springframework.ui.freemarker.FreeMarkerTemplateUtils; import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.FileOutputStream; import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; import java.util.Map; import java.util.Objects;Slf4j public class HtmlUtils {/*** return* throws Exception*/public static String getTemplateDirectory() {ClassLoader classLoader HtmlUtils.class.getClassLoader();URL resource classLoader.getResource(templates);try {return Objects.requireNonNull(resource).toURI().getPath();} catch (URISyntaxException e) {log.error(获取模板文件夹失败,{}, e);}return null;}/*** 获取模板内容** param templateName 模板文件名* param paramMap 模板参数* return* throws Exception*/public static String getTemplateContent(String templateName, MapString, Object paramMap) throws Exception {Configuration config ApplicationContextUtil.getBean(FreeMarkerConfigurer.class).getConfiguration();config.setDefaultEncoding(UTF-8);Template template config.getTemplate(templateName, UTF-8);return FreeMarkerTemplateUtils.processTemplateIntoString(template, paramMap);}/*** HTML 转 PDF** param content html内容* param outPath 输出pdf路径* return 是否创建成功*/public static boolean html2Pdf(String content, String outPath) {try {ConverterProperties converterProperties new ConverterProperties();converterProperties.setCharset(UTF-8);FontProvider fontProvider new FontProvider();fontProvider.addSystemFonts();converterProperties.setFontProvider(fontProvider);HtmlConverter.convertToPdf(content, new FileOutputStream(outPath), converterProperties);} catch (Exception e) {log.error(生成模板内容失败,{}, e);return false;}return true;}/*** HTML 转 PDF** param content html内容* return PDF字节数组*/public static void html2Pdf(HttpServletResponse response, String content,String filename) throws IOException {response.setHeader(Content-Type, application/octet-stream);response.setCharacterEncoding(utf-8);response.setHeader(Content-Disposition, attachment;filenamefilename.pdf);try (ServletOutputStream outputStream response.getOutputStream()) {ConverterProperties converterProperties new ConverterProperties();converterProperties.setCharset(UTF-8);FontProvider fontProvider new FontProvider();fontProvider.addSystemFonts();converterProperties.setFontProvider(fontProvider);HtmlConverter.convertToPdf(content, outputStream, converterProperties);} catch (Exception e) {log.error(生成 PDF 失败,{}, e);}} } ApplicationContextUtil代码、 import org.springframework.beans.BeansException; import org.springframework.boot.autoconfigure.AutoConfigureOrder; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.annotation.Configuration;Configuration AutoConfigureOrder(-1) public class ApplicationContextUtil implements ApplicationContextAware {private static ApplicationContext applicationContext null;public static Object getBeanByName(String beanName) {if (applicationContext null) {return null;}return applicationContext.getBean(beanName);}public static T T getBean(ClassT type) {return applicationContext.getBean(type);}Overridepublic void setApplicationContext(ApplicationContext applicationContext) throws BeansException {ApplicationContextUtil.applicationContext applicationContext;}}5、freemarker的基本语法 https://developer.aliyun.com/article/942606
http://www.zqtcl.cn/news/837930/

相关文章:

  • 权威网站发布平台wordpress 如何安装
  • 没有官方网站怎么做seo优化军事新闻
  • 在招聘网站做销售技巧教育培训平台
  • 网站栏目 英文做网站在哪接单
  • 湖北网络营销网站市场营销策划案
  • 政务信息系统网站建设规范上海网站开发制作公司
  • 网站公众平台建设方案湖南seo优化报价
  • 企业网站制作公司discuz 转wordpress
  • 可信网站是什么意思应用软件开发平台
  • 上海市官方网站福建省中嘉建设工程有限公司网站
  • 备案之后怎样把 放到网站上大连建设网球场价格
  • dkp网站开发今天最新新闻
  • 山东省环保厅官方网站建设项目东莞寮步网站设计
  • 网站开发可能遇到的问题附近电脑培训班位置
  • 如何查看域名以前是做什么网站的网站索引下降如何解决
  • 潜江 网站建设扬中话
  • 网站建设项目方案ppt广州建站模板平台
  • 房产部门成立网站免费seo推广软件
  • python做网站好处百度指数分析报告
  • 网站建设挣钱班级介绍网页制作模板
  • 工作室 网站建设app公司
  • 自己做的网站怎么在百度搜索到网页制作论文3000字
  • 如何网站托管中国跨境电商平台有多少
  • 手机p2p网站做平面设计兼职的网站有哪些
  • 贵金属网站建设唐山网站制作工具
  • 网站入门成都网站制作沈阳
  • 接做网站单子的网站做网站要会那些ps
  • 做盗市相关网站wordpress速度优化简书
  • 贵阳手机网站建设公司国内永久免费云服务器
  • 温州做网站定制哪家网络推广公司好