Java后台生成图片的完整步骤

网友投稿 331 2022-10-07


Java后台生成图片的完整步骤

前言

由于从事的是支付行业,最近对接的一些第三方支付有时候需要我们这边提供用户的资料和交易信息,并且以图片的形式发送给他们,由于这是后台程序自动处理,然后直接发送给第三方支付公司,因此需要后台查出用户的相关信息,然后生成图片,调用第三方提供的接口,将图片链接以附件的形式发给他们,当用户发起dispute操作的时候,触发我方后台的自动处理机制。

java后台生成图片

1. 依赖的jar包(maven依赖)

com.github.xuwei-k

html2image

0.1.0

2. 代码

package com.generatePic;

import gui.ava.html.image.generator.HtmlImageGenerator;

public class TestGeneratePic {

public static void main(String[] args) {

generatePic();

}

public static void generatePic() {

HtmlImageGenerator htmlImageGenerator = new HtmlImageGenerator();

//format 表示html里的元素,比如表格

String format = "

"

"

"\t\n" +

"

"

"

"\n" +

"\n" +

"

"

"

"

"

"

"

"

"

"

"\t

"

"

"

"

"

"\n" +

"\n" +

QKmQJ "

"

"

" \n" +

" PAYMENT INFOMATION \n" +

" \n" +

"

"

"

"\n" +

"

"

"

"

"

"

"

"

"

"

"\t

"

"

"

"\t

"

"

"

"\t

"

"

"

"\t

"

"

"

"\t

"

"

"

"\t

"

"

"

"

"

"
\n" +

QKmQJ "\n" +

"

"

"

" \n" +

" SERVICE HISTORY \n" +

" \n" +

"

"

"

"\n" +

"

"\n" +

"

\n" +

"

DATE\n" +

"

DESCRIPTION\n" +

"

AMOUNT\n" +

"

BALANCE\n" +

"

\n" +

"

\n" +

"

"

"

"

"

"

"

" \n" +

"

"

"

"

"

"

"

"

"

"

"

"

"

"

"

"\n" +

"\n";

String finalHtml = "" + format + "


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:ciscoasa l2tp radius 网关模式(ciscoasa5506x配置)
下一篇:企业如何评估国产防火墙能不能用?(防火墙 企业级)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~