Licence change receipt — generate this PDF with Java (Template)
Template1 页 A4 · 29 KB
Business licence change / filing receipt.

Output specs
- PDF pages
- 1
- Chart type
- Template
- Template lines
- 144
- Source lines
- 123
Java source · JQuickBiz158BusinessLicenseChangeReceipt.java
This is the complete test class that produced the PDF above — copy it and run as-is; see the quick-start section for the Maven dependency.
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright (c) [2025-2099] Martin ([email protected])
*/
package com.github.paohaijiao.biz.gov;
import com.github.paohaijiao.config.JPdfConfig;
import com.github.paohaijiao.executor.JQuickPdfFactory;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 单据 158:营业执照变更 / 备案回执(gov 领域第 4 项)。
*
* <p>本类为独立可运行 Demo:自带 {@code main} 方法、不依赖任何公共工具类或实体类,
* 数据以 key-value 形式通过 {@link JQuickPdfFactory#bindAll(Map)} 注入,
* 版式全部落在模板文件 {@code demo/biz/gov/158_business_license_change_receipt.txt} 中。</p>
*
* <p>视觉主题「靛蓝·密排·公文」:主色 #2098A8、辅色 #91274C、浅底 #F0F6F7;
* 版式为 doc 抬头 + strip 信息区 + compact 明细表 + two 签章区 + table 落款,
* 与同领域其它单据互不重样。</p>
*
* <p>营业执照变更 / 备案回执:企业名称与统一社会信用代码、变更备案类型,</p>
* <p>逐项变更项目(变更前 / 变更后)、办理结果与登记机关签章栏。</p>
*
* <p>运行后输出:{@code D:/test/pdf/158_business_license_change_receipt.pdf}。</p>
*
* @author Martin
* @version 1.0.0
*/
public class JQuickBiz158BusinessLicenseChangeReceipt {
private static final String PDF_DIR = "D:/test/pdf/";
private static final String OUT_FILE = PDF_DIR + "158_business_license_change_receipt.pdf";
private static final String TEMPLATE = "demo/biz/gov/158_business_license_change_receipt.txt";
/** 模板固定明细行数,不足时补空行,避免占位符原样输出。 */
private static final int ITEM_ROWS = 6;
public static void main(String[] args) throws IOException {
new File(PDF_DIR).mkdirs();
// ---------- 1. 数据(无实体类,直接 bind)----------
String[][] items = {
{"1", "企业名称", "××智能装备有限公司", "××智能装备制造有限公司", "2026-10-21"},
{"2", "住所", "××市××区智造大道 88 号", "××市××区智造大道 168 号 A 座", "2026-10-21"},
{"3", "注册资本", "人民币 2000 万元", "人民币 5000 万元", "2026-10-21"},
{"4", "法定代表人", "闻仲平", "闻仲平(不变)", "—"},
{"5", "经营范围", "智能装备研发、生产、销售", "增加:机器人系统集成、技术服务", "2026-10-21"},
{"6", "章程备案", "原章程(2024 版)", "新章程(2026 修订版)", "2026-10-21"}
};
Map<String, Object> data = new LinkedHashMap<String, Object>();
data.put("receiptNo", "BL-20261021-0055");
data.put("approveDate", "2026年10月21日");
data.put("orgName", "××市市场监督管理局");
data.put("companyName", "××智能装备制造有限公司");
data.put("creditCode", "91320100MA1X7K38XG");
data.put("changeType", "变更登记(名称、住所、注册资本)+ 章程备案");
data.put("oldRegNo", "320100000088123");
data.put("newRegNo", "320100000088456");
data.put("acceptInfo", "2026-10-15 / GS-20261015-03188");
data.put("result", "准予变更登记,已换发营业执照");
data.put("remark", "营业执照变更后,税务、银行、社保、公积金等登记信息须在 30 日内同步变更;营业执照正副本须同时换发。");
data.put("operator", "苏见宁");
data.put("approver", "闻仲平");
data.put("companySign", "崔行知");
// 明细逐格展开
for (int i = 0; i < ITEM_ROWS; i++) {
int n = i + 1;
if (i >= items.length) {
data.put("itemName" + n, "—");
data.put("itemSpec" + n, "—");
data.put("itemUnit" + n, "—");
data.put("itemQty" + n, "—");
data.put("itemAmount" + n, "—");
continue;
}
data.put("itemName" + n, items[i][0]);
data.put("itemSpec" + n, items[i][1]);
data.put("itemUnit" + n, items[i][2]);
data.put("itemQty" + n, items[i][3]);
data.put("itemAmount" + n, items[i][4]);
}
// ---------- 2. 渲染 ----------
JPdfConfig config = new JPdfConfig();
config.getLayoutConfig().setFlexLayout(true);
config.getDoc().setMargins(Arrays.asList(44, 44, 44, 44));
config.getFontConfig().setDefaultFontName("Noto Sans CJK SC");
config.getHeaderConfig().setEnabled(true);
config.getHeaderConfig().setText("××市市场监督管理局 营业执照变更 / 备案回执 BL-20261021-0055");
config.getHeaderConfig().setFontSize(8.5f);
config.getHeaderConfig().setHeight(34);
config.getFooterConfig().setEnabled(true);
config.getFooterConfig().setFontSize(8);
config.getFooterConfig().setPageNumberFormat("· %d ·");
JQuickPdfFactory factory = new JQuickPdfFactory(config);
factory.bindAll(data);
byte[] pdf = factory.executeResource(TEMPLATE);
Files.write(new File(OUT_FILE).toPath(), pdf);
System.out.println("已生成:" + OUT_FILE + "(" + pdf.length + " 字节)");
}
}Minimal invocation (3 lines)
Skip the full test class — the core is these three lines: bind the chart SVG, execute the template, get the PDF bytes. Copy them straight into your project.
// config 可省略;svg 来自 JChartRendererFactory.renderChart(...),见下方完整源码
byte[] pdf = new JQuickPdfFactory(config).executeResource("demo/biz/gov/158_business_license_change_receipt.txt");Template file · 158_business_license_change_receipt.txt
An HTML-like template with inline CSS that renders to PDF once bound to data. The full template is below — copy it or download the raw file.
<pdf>
<body>
// 158 营业执照变更 / 备案回执(gov 领域第 4 项) 视觉主题:靛蓝·密排·公文
// 版式组合:抬头=doc 信息区=strip 明细表=compact 段落=bar 签章=two 落款=table
// 主色 #2098A8 辅色 #91274C 浅底 #F0F6F7
// 营业执照变更回执与备案回执:变更项目的前后对比与核准日期。
// 抬头:doc
<p style="fontSize:20pt; bold:true; color:#2098A8; textAlignment:center; characterSpacing:9pt; marginBottom:2px">'营业执照变更 / 备案回执'</p>
<p style="fontSize:8pt; color:#78838C; textAlignment:center; marginBottom:4px">'回执编号 '${receiptNo}' 核准日期 '${approveDate}' 登记机关 '${orgName}</p>
<lineSeparator style="color:#2098A8; thickness:2f; marginBottom:8px"></lineSeparator>
// 信息区:grid2
<table style="width:100%; fontSize:8.5pt; marginBottom:8px">
<tr>
<td style="width:16%; padding:4px; backgroundColor:#F0F6F7; bold:true; border:1px solid #BDD5D8">'回执编号 / NO.'</td>
<td style="width:34%; padding:4px; border:1px solid #BDD5D8">${receiptNo}</td>
<td style="width:16%; padding:4px; backgroundColor:#F0F6F7; bold:true; border:1px solid #BDD5D8">'核准日期 / DATE'</td>
<td style="padding:4px; border:1px solid #BDD5D8">${approveDate}</td>
</tr>
<tr>
<td style="width:16%; padding:4px; backgroundColor:#F0F6F7; bold:true; border:1px solid #BDD5D8">'登记机关'</td>
<td style="width:34%; padding:4px; border:1px solid #BDD5D8">${orgName}</td>
<td style="width:16%; padding:4px; backgroundColor:#F0F6F7; bold:true; border:1px solid #BDD5D8">'企业名称'</td>
<td style="padding:4px; border:1px solid #BDD5D8">${companyName}</td>
</tr>
<tr>
<td style="width:16%; padding:4px; backgroundColor:#F0F6F7; bold:true; border:1px solid #BDD5D8">'统一社会信用代码'</td>
<td style="width:34%; padding:4px; border:1px solid #BDD5D8">${creditCode}</td>
<td style="width:16%; padding:4px; backgroundColor:#F0F6F7; bold:true; border:1px solid #BDD5D8">'变更 / 备案类型'</td>
<td style="padding:4px; border:1px solid #BDD5D8">${changeType}</td>
</tr>
<tr>
<td style="width:16%; padding:4px; backgroundColor:#F0F6F7; bold:true; border:1px solid #BDD5D8">'原执照注册号'</td>
<td style="width:34%; padding:4px; border:1px solid #BDD5D8">${oldRegNo}</td>
<td style="width:16%; padding:4px; backgroundColor:#F0F6F7; bold:true; border:1px solid #BDD5D8">'新执照注册号'</td>
<td style="padding:4px; border:1px solid #BDD5D8">${newRegNo}</td>
</tr>
<tr>
<td style="width:16%; padding:4px; backgroundColor:#F0F6F7; bold:true; border:1px solid #BDD5D8">'申请日期 / 受理编号'</td>
<td style="width:34%; padding:4px; border:1px solid #BDD5D8">${acceptInfo}</td>
<td style="width:16%; padding:4px; backgroundColor:#F0F6F7; bold:true; border:1px solid #BDD5D8">'办理结果'</td>
<td style="padding:4px; border:1px solid #BDD5D8">${result}</td>
</tr>
</table>
<p style="fontSize:10pt; bold:true; color:#2098A8; marginBottom:3px; characterSpacing:2pt">'变更 / 备案事项明细'</p>
<table style="width:100%; fontSize:7.5pt; marginBottom:8px">
<tr>
<th style="width:7%; padding:2px; backgroundColor:#0C7684; color:white; bold:true; textAlign:center; border:1px solid #0C7684">'序号'</th>
<th style="width:18%; padding:2px; backgroundColor:#0C7684; color:white; bold:true; textAlign:center; border:1px solid #0C7684">'变更项目'</th>
<th style="width:26%; padding:2px; backgroundColor:#0C7684; color:white; bold:true; textAlign:center; border:1px solid #0C7684">'变更前'</th>
<th style="width:26%; padding:2px; backgroundColor:#0C7684; color:white; bold:true; textAlign:center; border:1px solid #0C7684">'变更后'</th>
<th style="padding:2px; backgroundColor:#0C7684; color:white; bold:true; textAlign:center; border:1px solid #0C7684">'变更日期'</th>
</tr>
<tr>
<td style="padding:2px; textAlign:center; border:1px solid #DFE4E5">${itemName1}</td>
<td style="padding:2px; textAlign:center; border:1px solid #DFE4E5">${itemSpec1}</td>
<td style="padding:2px; textAlign:left; border:1px solid #DFE4E5">${itemUnit1}</td>
<td style="padding:2px; textAlign:left; border:1px solid #DFE4E5">${itemQty1}</td>
<td style="padding:2px; textAlign:center; border:1px solid #DFE4E5">${itemAmount1}</td>
</tr>
<tr>
<td style="padding:2px; textAlign:center; border:1px solid #DFE4E5">${itemName2}</td>
<td style="padding:2px; textAlign:center; border:1px solid #DFE4E5">${itemSpec2}</td>
<td style="padding:2px; textAlign:left; border:1px solid #DFE4E5">${itemUnit2}</td>
<td style="padding:2px; textAlign:left; border:1px solid #DFE4E5">${itemQty2}</td>
<td style="padding:2px; textAlign:center; border:1px solid #DFE4E5">${itemAmount2}</td>
</tr>
<tr>
<td style="padding:2px; textAlign:center; border:1px solid #DFE4E5">${itemName3}</td>
<td style="padding:2px; textAlign:center; border:1px solid #DFE4E5">${itemSpec3}</td>
<td style="padding:2px; textAlign:left; border:1px solid #DFE4E5">${itemUnit3}</td>
<td style="padding:2px; textAlign:left; border:1px solid #DFE4E5">${itemQty3}</td>
<td style="padding:2px; textAlign:center; border:1px solid #DFE4E5">${itemAmount3}</td>
</tr>
<tr>
<td style="padding:2px; textAlign:center; border:1px solid #DFE4E5">${itemName4}</td>
<td style="padding:2px; textAlign:center; border:1px solid #DFE4E5">${itemSpec4}</td>
<td style="padding:2px; textAlign:left; border:1px solid #DFE4E5">${itemUnit4}</td>
<td style="padding:2px; textAlign:left; border:1px solid #DFE4E5">${itemQty4}</td>
<td style="padding:2px; textAlign:center; border:1px solid #DFE4E5">${itemAmount4}</td>
</tr>
<tr>
<td style="padding:2px; textAlign:center; border:1px solid #DFE4E5">${itemName5}</td>
<td style="padding:2px; textAlign:center; border:1px solid #DFE4E5">${itemSpec5}</td>
<td style="padding:2px; textAlign:left; border:1px solid #DFE4E5">${itemUnit5}</td>
<td style="padding:2px; textAlign:left; border:1px solid #DFE4E5">${itemQty5}</td>
<td style="padding:2px; textAlign:center; border:1px solid #DFE4E5">${itemAmount5}</td>
</tr>
<tr>
<td style="padding:2px; textAlign:center; border:1px solid #DFE4E5">${itemName6}</td>
<td style="padding:2px; textAlign:center; border:1px solid #DFE4E5">${itemSpec6}</td>
<td style="padding:2px; textAlign:left; border:1px solid #DFE4E5">${itemUnit6}</td>
<td style="padding:2px; textAlign:left; border:1px solid #DFE4E5">${itemQty6}</td>
<td style="padding:2px; textAlign:center; border:1px solid #DFE4E5">${itemAmount6}</td>
</tr>
</table>
// 段落:bar
<table style="width:100%; marginBottom:2px">
<tr>
<td style="width:4px; padding:0px; backgroundColor:#91274C">' '</td>
<td style="padding:2px; bold:true; fontSize:10.5pt; color:#0C7684">'办理结果'</td>
</tr>
</table>
<p style="fontSize:9pt; marginBottom:6px">${result}</p>
<table style="width:100%; marginBottom:2px">
<tr>
<td style="width:4px; padding:0px; backgroundColor:#91274C">' '</td>
<td style="padding:2px; bold:true; fontSize:10.5pt; color:#0C7684">'备注 / REMARKS'</td>
</tr>
</table>
<p style="fontSize:9pt; marginBottom:6px">${remark}</p>
// 签章区:two
<!-- 签章占位区:后续加盖电子公章 / 骑缝章 / 打印二维码 -->
<table style="width:100%; fontSize:8pt; marginBottom:8px">
<tr>
<td style="width:50%; padding:4px; textAlign:center; color:#2098A8; border:1px dashed #2098A8">'(行政审批专用章 / 公章占位)'</td>
<td style="padding:4px; textAlign:center; color:#2098A8; border:1px dashed #2098A8">'(骑缝章 / 二维码占位)'</td>
</tr>
<tr>
<td style="width:50%; padding:4px; textAlign:center; color:#78838C; border:1px dashed #2098A8">'受理机关:'${orgName}</td>
<td style="padding:4px; textAlign:center; color:#78838C; border:1px dashed #2098A8">'骑缝章沿右边线骑缝加盖'</td>
</tr>
<tr>
<td style="width:50%; padding:4px; textAlign:center; color:#78838C; border:1px dashed #2098A8">'办结日期:'${approveDate}</td>
<td style="padding:4px; textAlign:center; color:#78838C; border:1px dashed #2098A8">'二维码打印于右上角方框内'</td>
</tr>
</table>
// 落款:table
<!-- 落款栏 -->
<table style="width:100%; fontSize:8.5pt">
<tr>
<td style="width:33%; padding:5px; border:1px solid #BDD5D8">'登记经办人:'${operator}</td>
<td style="width:33%; padding:5px; border:1px solid #BDD5D8">'核准人:'${approver}</td>
<td style="padding:5px; border:1px solid #BDD5D8">'企业签收:'${companySign}</td>
</tr>
</table>
</body>
</pdf>More demos in this group
The PDF, preview image, template and source code on this page were all produced by a real JQuick-Pdf run and are free to copy into your own project.